Duplicate Remover
JavaScript
20 pts
Duplicate Remover
Write two functions that use a Set:
uniqueList(items)returns a new array without duplicates, in the original order.countUnique(items)returns how many different values there are.
Then print the results for words and for [3, 3, 3]. Expected output:
[ "the", "cat", "and", "dog", "bird" ] 5 1
Checklist
uniqueList(items)returns an array without duplicates.countUnique(items)returns the number of different values.- Use a Set inside your functions.
- Print the three results.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
