addUniqueName that has two parameters - one called
name of type
String and the other called
names of type
The function will take the
name and add it to the
names array only if that name is not already in the array.
You CANNOT use any type of for loop to solve this problem.
Change the parameter
names be of type
Object instead of
Add a new key/value pair to the names object only if unique.
This will change how your code from part one works.