我有两个数组
a[] = [1,2,3,4]
b[] = [1,4]
需要从数组a中移除数组b的元素。
预期输出:
a[] = [1,4]
最佳答案
我会使用过滤方法:
a = a.filter(function (item) {
return b.indexOf(item) === -1;
});
关于javascript - 使用javascript从另一个数组中删除一个数组的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40031165/