Loading problem…
Implement a uniq function that returns a new array with duplicate values removed, keeping only the first occurrence of each value.
uniq
uniq([1, 2, 2, 3, 1, 4]); // Returns: [1, 2, 3, 4] uniq(['a', 'b', 'a', 'c', 'b']); // Returns: ['a', 'b', 'c'] uniq([NaN, 1, NaN, 2]); // Returns: [NaN, 1, 2]
3 hints available with Pro
Medium
Easy