Mistakes I made #01 - Array.prototype.indexOf
20.11.2016
Today I want to talk about a misconception about Array.prototype.indexOf I came across a few days ago.
What is it doing? 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. (MDN)
So this is pretty simple to understand, right? … Nope! Not for me as my mistake will show you.
Playing around with it So here are some examples: