js判断两个数组是否相等
let a = [
{name:"1",age:10,color:"#fff",style:{'font-size':'24px', 'display':'none',children:{name:"1-1"}}},
{name:"2",age:20,color:"#000",style:{fontSize:'24px', 'display':'block',children:{name:"2-1"}}}
]
let b = [
{name:"1",age:10,color:"#fff",style:{'font-size':'12px', 'display':'none',children:{name:"1-1"}}},
{name:"2",age:20,color:"#000",style:{fontSize:'24px', 'display':'block',children:{name:"2-1"}}}
]
const result = (a,b)=>{
return JSON.stringify(a) === JSON.stringify(b)
}
console.log(result(a,b)) // true 可随意修改两个参数 不相等返回false