從數組中移除重複元素

從數組中移除重複元素

const removeDuplicateItems = arr => [...new Set(arr)];

removeDuplicateItems([23, 'success', 23, 'success', false, false]);

console.log(arr)
結果是//=>[23, 'success', false]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章