using a js set to get unique values code example
Example 1: js unique using set
let uniqueArray = [...new Set([5,5,2,2,2,4,2])];
// [5,2,4]
Example 2: array unique values javascript
const myArray = ['a', 1, 'a', 2, '1'];
const unique = [...new Set(myArray)]; // ['a', 1, 2, '1']