js for循环删除两个数组相同元素
1 var id = ['a','b','c','a','d','a','a','b','d','c','a','b','c','a','b','c'] 2 var del = ['a','c']; 3 var temp01 = []; 4 var temp02 = []; 5 6 for(var i in del){ 7 temp01[del[i]] = true; 8 } 9 10 for (var k in id){ 11 if(!temp01[id[k]]){ 12 temp02.push(id[k]) 13 } 14 } 15 16 console.log(temp02);