### Remove duplicated elements in array in JS (ES6) We have the following case: ```js // we have an array with some duplicated elements let data = [1, 2, 3, 1, 4, 2, 6, 5, 6, 2]; // we want to remove duplicated elements and get the result like below [1, 2, 3, 4, 6, 5]; ``` ### Set By using `Set`and spread syntax, we can easily achieve this: ```js // using set and spread syntax data = [ ...new Set(data) ]; console.log(data); > [1, 2, 3, 4, 6, 5]; ```