This content was proof-read by Grammarly. You can Try Grammary for FREE
When using the indexOf method , if the value is found, it returns the index representing the array element. If the value is not found, then the value –1 is returned.
Below is a sample code snippet demonstrating the search of an element in a array using indexOf method.