New course! Every coder should learn Generative AI!
Try a free lesson+ 2
Why would indexOf method give me a -1 as an output ?
2 Answers
+ 6
-1 means here that it's index cannot be found, so the letter or char sequence you looked for isn't present in the string.
+ 4
It just means your target was not found.