Name

lastIndexOf() — NN 2 IE J1 ECMA 1

Synopsis

lastIndexOf(searchString[,
startPositionIndex])

Returns a zero-based integer of the position within the current string object where the searchString parameter starts. This method works like the indexOf() method but begins all searches from the end of the string or some index position. Even though searching starts from the end of the string, the startPositionIndex parameter is based on the start of the string, as is the returned value. If there is no match, the returned value is -1.

Returned Value

Integer.

Parameters

searchString

A string to look for in the current string object.

startPositionIndex

A zero-based integer indicating the position within the current string object to begin the search of the first parameter. Even though the search starts from the end of the string, this parameter value is relative to the front of the string.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.