var set = new Set();
var arr = [1, 2, 3, 3, 2, 1];
arr.map(val => set.add(val));
// arr.map(function(val) {
// set.add(val);
// })
arr = [];
for(i of set) {
arr.push(i);
}
console.log(arr) // [1, 2, 3]
function dedupe(array) { return Array.from(new Set(array)); } dedupe([1, 1, 2, 3]) // [1, 2, 3]