js compares whether two object arrays are the same

1. js compares whether two object arrays are exactly the same

let obj1 = [{"id" : 1, "name" : "xiaoMing"}];
let obj2 = [{"id" : 1, "name" : "xiaoMing"}];
var isEqualN = JSON.stringify(obj1) === JSON.stringify(obj2);
console.log(isEqualN);//true
let obj1 = [{"id" : 1, "name" : "xiaoMing"}];
let obj2 = [{"id" : 1, "name" : "xiaoMi"}];
var isEqualN = JSON.stringify(obj1) === JSON.stringify(obj2);
console.log(isEqualN);//false

2. js judges whether the value of the array/the attribute value of the object array is the same every(), some()

https://blog.csdn.net/qq_40015157/article/details/110952388

 

3. js compares whether the two arrays are the same

https://blog.csdn.net/qq_40015157/article/details/110792580

Guess you like

Origin blog.csdn.net/qq_40015157/article/details/112790147