CristalT
1/18/2019 - 4:52 PM

Two ways to remove array duplicates

// Two ways to remove array duplicates
const array = [1, 2, 3, 4, 4, 4, 5]

// Way 1
let uniq = array.filter((el, index) => array.indexOf(el) === index)
console.log(uniq)

// Way 2
uniq = [...new Set(array)]
console.log(uniq)