相关疑难解决方法(0)

从JavaScript中的对象数组中删除重复项

我有一个包含对象数组的对象.

things = new Object();

things.thing = new Array();

things.thing.push({place:"here",name:"stuff"});
things.thing.push({place:"there",name:"morestuff"});
things.thing.push({place:"there",name:"morestuff"});
Run Code Online (Sandbox Code Playgroud)

我想知道从数组中删除重复对象的最佳方法是什么.所以,例如,事情会变成......

{place:"here",name:"stuff"},
{place:"there",name:"morestuff"}
Run Code Online (Sandbox Code Playgroud)

javascript arrays object duplicates

306
推荐指数
29
解决办法
32万
查看次数

标签 统计

arrays ×1

duplicates ×1

javascript ×1

object ×1