this challenge is talking about the indexOf method, which returns -1 for non-existing elements but returns the index if the element exists on an array, the comment on the example given in the explanation is wrong: (…indexOf('pears')
returns 1
… )it should return 4.
the link to the challenge
It returns the index of the first occurance of the ele.ment. Look at index 1 in the array
oh there are 2 strings ‘pear’.
sorry
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.