javascript get unique values code example
Example 1: javascript array unique values
var arr = [55, 44, 65,1,2,3,3,34,5];
var unique = [...new Set(arr)]
Example 2: javascript find unique values in array
var myArray = ['a', 1, 'a', 2, '1'];
var unique = myArray.filter((v, i, a) => a.indexOf(v) === i);
Example 3: array unique values javascript
const myArray = ['a', 1, 'a', 2, '1'];
const unique = [...new Set(myArray)];
Example 4: unique values in array javascript
let uniqueItems = [...new Set(items)]
Example 5: javascript get unique values from key
const unique = [...new Set(array.map(item => item.age))];