indexOf indexOf
Checks if the first argument string ends with a specific string (second argument string). If the string is not found, return -1.
Category
String
Function syntax
indexOf(<parameters>)
Parameters
Parameter
Type
string
String
specified value
String
Signature and returned type
indexOf(<string>,<string>)
Returns an integer.
Example
indexOf("Hello", "l")
Returns 2.
Explanation:
In “Hello”, the first occurrence of “l” is at position 2.
recommendation-more-help
4f4a00c1-77c9-4eee-84df-bbe6206c3ab9