Thursday, 26 November 2015

Remove Array Duplicates in ES6

We can use Set and spread operator to remove duplicates from an array.
[...new Set([1,2,3,1,2,3])];  // [1,2,3]
Array.from(new Set([1,2,3,1,2,3]));  // [1,2,3]