to remove duplicate element in aray code example
Example 1: remove duplicates from array
let chars = ['A', 'B', 'A', 'C', 'B'];
let uniqueChars = [...new Set(chars)];
console.log(uniqueChars);
output:
[ 'A', 'B', 'C' ]
Example 2: remove duplicate value from array
let chars = ['A', 'B', 'A', 'C', 'B'];
let uniqueChars = [...new Set(chars)];
console.log(uniqueChars);