I am trying to solve a challenge from jshero.net.
The challenge is:
Write a function add that adds an element to the end of an array. However, the element should only be added if it is not already in the array.
add([1, 2], 3)should return[1, 2, 3]andadd([1, 2], 2)should return[1, 2].
The problem is for Array:indexOf(). Does anyone know how to solve it?
 
     
    