var county =[ {name: "鹿城区", value: 8340363, code: "330302"}, {name: "龙湾区", value: 576804, code: "330303"}, {name: "瓯海区", value: 14376314, code: "330304"}, {name: "洞头区", value: 305933, code: "330305"}, {name: "永嘉县", value: 1034338, code: "330324"}, {name: "永嘉县", value: 1034338, code: "3303241"}, {name: "平阳县", value: 1262985, code: "330326"}, {name: "苍南县", value: 917294, code: "330327"}, {name: "文成县", value: 211791, code: "330328"}, {name: "文成县", value: 211791, code: "330328"}, {name: "泰顺县", value: 230159, code: "330329"}, {name: "瑞安市", value: 897806, code: "330381"}, {name: "乐清市", value: 3829048, code: "330382"}, {name: "龙港市", value: 417067, code: "330383-core"}, {name: "龙港市", value: 417067, code: "330383"} ] //去重 const newArr = new Map() county = county.filter((a) => !newArr.has(a.name) && newArr.set(a.name, 1)) console.log('去重输出', county)
上面是“最简单的js数组去重方法”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_1553.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!