The indexOf
method returns the index of the searched string. If the string is not found, it returns -1
. That’s why you have that comparison, it’s to make sure that the searched string is found.
1
solved Need an If Statement syntax explanation [closed]