标签:设置 去重 嵌套 color bsp reduce span new 数组
1 let obj = {}; 2 newArr = newArr.reduce((cur, next) => { 3 obj[next.id] ? ‘‘ : (obj[next.id] = true && cur.push(next)); 4 return cur; 5 }, []); //设置cur默认类型为数组,并且初始值为空的数组
我在群里小伙伴,好多人都在问,我就记下来吧
标签:设置 去重 嵌套 color bsp reduce span new 数组
原文地址:https://www.cnblogs.com/xiaofenghuang/p/13036711.html