how to get unique names oin array typescript 1

how to get unique names oin array typescript

var a = [1, 1, 2];

[... new Set(a)]

Here is what the above code is Doing:
1. We create a new Set object with the values of the array.
2. We use the spread operator (…) to spread the values of the set into a new array.
3. The new array has only unique values.

Similar Posts