JavaScript 去掉对象数组中key值相同的对象

题目描述

去掉对象数组中key值相同的对象

题目来源及自己的思路

相关代码

let arr = [
  {"weight":10,"id":1},
  {"weight":20,"id":2},
  {"weight":30,"id":2},
  {"weight":40,"id":4},
  {"weight":50,"id":5}
];

你期待的结果是什么?实际看到的错误信息又是什么?

let arr = [
  {"weight":10,"id":1},
  {"weight":30,"id":2},
  {"weight":40,"id":4},
  {"weight":50,"id":5}
];


慕森卡
浏览 2264回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript