1var arr = [55, 44, 65,1,2,3,3,34,5];
2var unique = [...new Set(arr)]
3
4//just var unique = new Set(arr) wont be an array
1// usage example:
2var myArray = ['a', 1, 'a', 2, '1'];
3var unique = myArray.filter((v, i, a) => a.indexOf(v) === i);
4
5// unique is ['a', 1, 2, '1']
1let a = ["1", "1", "2", "3", "3", "1"];
2let unique = a.filter((item, i, ar) => ar.indexOf(item) === i);
3console.log(unique);
1const myArray = ['a', 1, 'a', 2, '1'];
2const unique = [...new Set(myArray)]; // ['a', 1, 2, '1']
1// one liner solution to get a unique array by object id
2[{_id: 10},{_id: 20}, {_id: 20}].filter((item, i, ar) => ar.findIndex(each => each._id === item._id) === i)