javascript array combine duplicates code example
Example 1: javascript dedupe 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: javascript remove duplicates from array
unique = [...new Set(arr)]; // where arr contains duplicate elements