indexof

Searching…

developer.mozilla.org

Array.prototype.indexOf () - JavaScript | MDN

Jul 10, 2025 · 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.

www.w3schools.com

JavaScript String indexOf () Method - W3Schools

Description The indexOf() method returns the position of the first occurrence of a value in a string. The indexOf() method returns -1 if the value is not found. The indexOf() method is case sensitive.

www.javascripttutorial.net

JavaScript String indexOf () Method

The indexOf() returns the index of the first occurrence of a substring in a string, or -1 if the string does not contain the substring. The indexOf() always performs a case-sensitive search.

www.programiz.com

JavaScript Array indexOf () - Programiz

indexOf () Return Value Returns the first index of the element in the array if it is present at least once. Returns -1 if the element is not found in the array. Note: indexOf() compares searchElement to elements of th...

www.geeksforgeeks.org

JavaScript Array indexOf () Method - GeeksforGeeks

Sep 27, 2024 · The indexOf () method in JavaScript is used to find the position of the first occurrence of a specific value in an array. If the value is not present, it returns -1.

www.freecodecamp.org

Check For The Presence of an Element With indexOf ()

indexOf() can be incredibly useful for quickly checking for the presence of an element on an array. We have defined a function, quickCheck, that takes an array and an element as arguments.