es6 set to array prevent duplicates code example
Example 1: prevent duplicate entries in javascript array
if (array.indexOf(value) === -1) array.push(value);
Example 2: remove duplicate array es6
let a = [10,20,30,10,30];
let b = [... new Set(a)];
console.log(b);