filter duplicates in array using set javascript code example
Example 1: js delete duplicates from array
const names = ['John', 'Paul', 'George', 'Ringo', 'John'];
let x = (names) => names.filter((v,i) => names.indexOf(v) === i)
x(names); // 'John', 'Paul', 'George', 'Ringo'
Example 2: remove duplicate array es6
let a = [10,20,30,50,30];
let b = a.reduce((unique,item) => unique.includes(item) ? unique: [... unique, item] ,[]);
console.log(b);