find unique elements in array javascript

JavaScript
const myArray = [1,2,3,1,5,8,1,2,9,4];
const unique = [...new Set(myArray)]; // [1, 2, 3, 5, 8, 9, 4]

const myString = ["a","b","c","a","d","b"];
const uniqueString = [...new Set(myString)]; //["a", "b", "c", "d"]var arr = [55, 44, 65,1,2,3,3,34,5];
var unique = [...new Set(arr)]

//just  var unique = new Set(arr) wont be an arrayconst unique = [...new Set(array.map(item => item.age))];const categories = ['General', 'Exotic', 'Extreme', 'Extreme', 'General' ,'Water', 'Extreme']
.filter((value, index, categoryArray) => categoryArray.indexOf(value) === index);

This will return an array that has the unique category names
['General', 'Exotic', 'Extreme', 'Water']

let a = ["1", "1", "2", "3", "3", "1"];
let unique = a.filter((item, i, ar) => ar.indexOf(item) === i);
console.log(unique);
Source

Also in JavaScript: