String indexOf() Method Parameters:
The `indexOf()` method takes two arguments:
- The first argument is the value that we want to find its location in the target string.
- The second argument is the location (index number) from which we want this search to begin. The default value is set to 0, which means the search should begin from the start position of that string.
String indexOf() Method Return Value:
The indexOf() method returns the index number of the first occurrence of the value we set as its argument.
- If the value does not exist in the target string, the return value will be -1.
- The method is case sensitive. This means if the argument is “test” for example, but in the target string there’s a value “Test” with the first letter being capital, then the final result becomes -1.
const message = "The relationship between passion and determination is one-to-many!" console.log(message.indexOf("between")); console.log(message.indexOf("passion"));