Glossary Term
String.prototype.lastIndexOf()
The lastIndexOf() method of String values searches this string and returns the index of the last occurrence of the specified substring. It takes an optional starting position and returns the last occurrence of the specified substring at an index less than or equal to the specified number.
Strings are zero-indexed: The index of a string’s first character is 0, and the index of a string’s last character is the length of the string minus 1.
Return value: The index of the last occurrence of searchString found, or -1 if not found.
Parameters: searchString Substring to search for. All values are coerced to strings, so omitting it or passing undefined causes lastIndexOf() to search for the string “undefined”, which is rarely what you want.
Syntax example: lastIndexOf(searchString)
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
