数组去重
利用Set()
return Array.from(new Set(array))
//return [...new Set(array)]
filter实现
return arr.filter(function(item, index, array) {
return array.indexOf(item, 0) === index;
});
标签:Set,return,面试,js,牛客,item,array
From: https://www.cnblogs.com/badpear/p/16838442.html