set array no unique code example
Example 1: js unique using set
let uniqueArray = [...new Set([5,5,2,2,2,4,2])];
// [5,2,4]
Example 2: get only unique values from array javascript
arr = [2, 2, 2, 1, 3, 3, 3,3, 4, 5];
arr = arr.sort().filter((item,i)=>!(arr[i] == arr[i+1] || arr[i-1]==arr[i]));
// this will remove all item which are repeating more then one
console.log(arr);
// [1, 4, 5]