@rafaelrochas91
I believe we are saying the same thing. However, I did notice a copy/paste error in the title. I had Array.indexOf(callback). Just changed it to Array.indexOf(item). Thanks for the feedback!
"The indexOf() method returns the first index at which a given
element can be found in the array, or -1 if it is not present."
So if we had an array of something silly like:
constarr=['hello','hello','hello']// only the first item in the array will be returned. console.log(arr.indexOf('hello'))// => 0
@rafaelrochas91 I believe we are saying the same thing. However, I did notice a copy/paste error in the title. I had
Array.indexOf(callback)
. Just changed it toArray.indexOf(item)
. Thanks for the feedback!"The indexOf() method returns the first index at which a given
element can be found in the array, or -1 if it is not present."
So if we had an array of something silly like:
Yes exactly.
You're welcome, good post nonetheless!
Much appreciated!