前端面試題 數組去重

方式一 set function unique(arr) { return [...new Set(arr)] }; 方式二 indexof function unique(arr) { let res = []; arr.forEach(item => { if (res.indexOf(item) === -1) { res.pu
相關文章
相關標籤/搜索