JavaScript Array method: lastIndexOf()
[this page | pdf | back links]
The lastIndexOf() method (when applied to a
JavaScript
array) returns
the index of the first element of an array found when an array is searched,
backwards from the end.
It
has the following syntax with the following parameters. It returns a number
as above (or -1 if no array element passes the test).
array.lastIndexOf(item, start)
|
Parameter
|
Required / Optional
|
Description
|
|
item
|
Required
|
Item to search for
|
|
start
|
Optional
|
Index value at which to
start search. Negative values indicate start from a position counting from
the beginning and then search backwards to the start
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript Arrays