标签:return 快速 div 数组 function color set let nbsp
使用new Set()快速数组去重:
let arr = [1, 2, 2, 3, 4, 5, 5, 5, 6] let set = new Set([...arr]) console.log([...set]) //[1, 2, 3, 4, 5, 6] function SetArr(array) { return Array.from(new Set(array)); } console.log(SetArr([1, 1, 2, 2, 3, 4, 4])) // [1, 2, 3,4]
标签:return 快速 div 数组 function color set let nbsp
原文地址:https://www.cnblogs.com/lwming/p/11123461.html