摘要: 数组 取并集let a=new Set([1,2,3,4,5]);let b=new Set([1,2,3,4,5,6,7,8,9]);let arr = Array.from(new Set([...a, ...b]));console.log('arr',arr);结果 取交集let a=new 阅读全文
posted @ 2020-02-26 12:25 loveAline 阅读(4182) 评论(0) 推荐(0) 编辑
摘要: 最近在看阮一峰老师的《ES6 入门》 在看到Set数据结构实现数组的交集,并集还有差集,但是阮一峰老师实现差集貌似有点问题,特地来做下笔记: const a = {fn: 1}; const set = new Set([1,1,2,2,3,4,5,5,5,a,'a']); const b = ne 阅读全文
posted @ 2020-02-26 12:03 loveAline 阅读(926) 评论(0) 推荐(0) 编辑