摘要: 数组去重 const arr = [1, 1, '1', 17, true, true, false, false, 'true', 'a', {}, {}];// => [1, '1', 17, true, false, 'true', 'a', {}, {}] 方法一:利用Set const r 阅读全文
posted @ 2020-09-29 17:46 小名香菜~ 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 01.数组扁平化 数组扁平化是指将一个多维数组变为一个一维数组 const arr = [1, [2, [3, [4, 5]]], 6];// => [1, 2, 3, 4, 5, 6] 方法一:使用flat() const res1 = arr.flat(Infinity); 方法二:利用正则 c 阅读全文
posted @ 2020-09-29 17:37 小名香菜~ 阅读(141) 评论(0) 推荐(0) 编辑