Thursday, November 26, 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]