A set is a collection of unique items. A set can be formed from an array from removing all duplicate items.
[1, 3, 3, 5, 5, 5]
// original array
[1, 3, 5]
// original array transformed into a set
Create a function that transforms an array into a set.
noDuplicate([1, 3, 3, 5, 5]) ➞ [1, 3, 5]
noDuplicate([4, 4, 4, 4]) ➞ [4]
noDuplicate([5, 7, 8, 9, 10, 15]) ➞ [5, 7, 8, 9, 10, 15]
Note: For this question, output an array, not a set. These are two distinctly different data structures in Javascript (although they can be converted from one to the other).