arrChange( a, b ){
for (var i = 0; i < b.length; i++) {
for (var j = 0; j < a.length; j++) {
if (a[ j ] == b[ i ]) {
a.splice(j, 1);
j = j - 1;
}
}
}
return a;
}
var a=[1,2,3,4,5,6,7,8]
var b=[4,5,6,7,8,9,10]
this.arrChange(a,b)
console.log(a)//[1, 2, 3]
网友评论