奋斗的渣渣
2020-04-10 16:02
function arraysSimilar(arr1, arr2){
let flag = false;
for(var i=0;i<arr1.length;i++){
var type1 = Object.property.toString().call(arr1[i])
for(var j=0;j<arr2.length;j++){
var type2 = Object.property.toString().call(arr2[i])
if(type1 == type2){
flag = true
break;
}
if(flag){
continue
} else {
break
}
}
}
}
return falg
}
function arraysSimilar(arr1, arr2) {
var type1, type2
let flag = false
for (var i = 0; i < arr1.length; i++) {
type1 = Object.prototype.toString.apply(arr1[i])
console.log(type1)
for (var j = 0; j < arr2.length; j++) {
type2 = Object.prototype.toString.apply(arr2[i])
if (type1 == type2) {
flag = true
break
}
if (flag) {
continue
} else {
break
}
}
}
return flag
}
function arraysSimilar(arr1, arr2) { var type1, type2 let flag = false for (var i = 0; i < arr1.length; i++) { type1 = Object.prototype.toString.apply(arr1[i]) console.log(type1) for (var j = 0; j < arr2.length; j++) { type2 = Object.prototype.toString.apply(arr2[i]) if (type1 == type2) { flag = true break } if (flag) { continue } else { break } } } return flag } 给你做了下修改,就可以用了。
JavaScript深入浅出
281111 学习 · 1020 问题
相似问题