【发布时间】:2018-08-07 04:01:20
【问题描述】:
如何从一个数组中删除多个对象?
目前我有
let arry1 = [
{
id:0,
name:'My App',
another:'thing',
},
{
id:1,
name:'My New App',
another:'things'
},
{
id:2,
name:'My New App',
another:'things'
}
];
然后我有一个这样的索引数组
let arry2 = [1, 2]; // Indexes to delete
最终结果必须是:
let arry1 = [{
id:0,
name:'My App',
another:'thing',
}]
【问题讨论】:
-
可以使用ES6过滤器数组方式:developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
-
你尝试了什么?使用
.filter
标签: javascript arrays javascript-objects