I have a simple array that displays different versions of my name.
Here is the array:
let allNames = ["Kenny", "Ken", "Ken", "kenny", "ken", "ken", "Kenny", "Ken", "Ken", "kenny", "ken", "ken", "Kenny", "Ken", "Ken"];
But when I tried using the indexOf method, this is what happened.
allNames.indexOf(4);
-1
Then I attempted this.
allNames.indexOf('kenny');
-1
What am I missing? I understand that -1 signifies that the element was not found, but there must be something crucial about this method that I don't know.
Thanks for your help in advance! Your insights are greatly appreciated :)
Edit: I tested this on jsfiddle and it worked fine. I can't quite grasp why it's not working in Chrome Developer Tools. Your guesses are as good as mine. Nonetheless, thank you for the assistance. This community is awesome! :D