function arraysSimilar(arr1, arr2){ if(arr1 === null && arr2 === null){ return true; } if(!Array.isArray(arr1)||!Array.isArray(arr2)||arr1.length!=arr2.length){ return false; } var len = arr1.length; var arr3,arr4; for(let i = 0;i < len;i ++){ arr3.push(typeof(arr1[i])); arr4.push(typeof(arr2[i])); } arr3.sort().toString(); arr4.sort().toString(); if(arr3 === arr4){ return true; } else return false; }
添加回答
举报
0/150
提交
取消