removing duplicates from arrays in functional javascript code example
Example 1: javascript remove duplicates from array
// for TypeScript and JavaScript
const initialArray = ['a', 'a', 'b',]
finalArray = Array.from(new Set(initialArray)); // a, b
Example 2: javascript remove duplicates from array
unique = [...new Set(arr)]; // where arr contains duplicate elements