remove duplicates in place from array javascript code example
Example 1: javascript remove duplicates from array
unique = [...new Set(arr)]; // where arr contains duplicate elements
Example 2: remove duplicates array javascript
var data = [1, 2, 'Peter', 3, 3,'Peter', 2, 2, 1, 2, 3, 4, 4, 5, 4];
var unique = data.filter((v, i, a) => a.indexOf(v) === i);