Glossary Term
Array.prototype.indexOf()
The indexOf() method of Array instances returns the first index at which a given element can be found in the array, or -1 if it is not present.
The indexOf() method compares searchElement to elements of the array using strict equality (the same algorithm used by the === operator). NaN values are never compared as equal, so indexOf() always returns -1 when searchElement is NaN.
The indexOf() method skips empty slots in sparse arrays.
The indexOf() method is generic. It only expects the this value to have a length property and integer-keyed properties.
Return value: The first index of searchElement in the array; -1 if not found.
Syntax example: indexOf(searchElement)
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…
