var arr1=[null,false,100],arr2=[1,true,null]; function arraysSimilar(arr1, arr2){ if(!(arr1 instanceof Array) || !(arr2 instanceof Array)){return false;} if(arr1.length!==arr2.length){ return false;} var a=[],b=[]; for(var i=0;i<arr1.length;i++){ if(arr1[i]!==null){ a.push(arr1[i]); }else{a.push(typeof arr1[i]); } if(arr2[i]==null){ b.push(arr2[i]); }else{ b.push(typeof arr2[i]); } var cc = (a.join("").sort().toString()==b.join("").sort().toString())?true:false; alert(cc+"弹"); return cc; } }
添加回答
举报
0/150
提交
取消