vue js判断两个数组是否相等
arrEuqalse(arr1, arr2) {if (!arr1 || !arr2) {return false;}if (arr1.length != arr2.length) {return false;}for (var i = 0; i < arr2.length; i++) {...
·
arrEuqalse(arr1, arr2) {
if (!arr1 || !arr2) {
return false;
}
if (arr1.length != arr2.length) {
return false;
}
for (var i = 0; i < arr2.length; i++) {
if (arr1.indexOf(arr2[i]) == -1) {
return false;
}
}
for (var i = 0; i < arr1.length; i++) {
if (arr2.indexOf(arr1[i]) == -1) {
return false;
}
}
return true;
}
更多推荐
已为社区贡献5条内容
所有评论(0)