js unique using set
snippet in javascript

js unique using set

user4714

let uniqueArray = [...new Set([5,5,2,2,2,4,2])];
// [5,2,4]