Javatpoint Logo
Javatpoint Logo

JavaScript TypedArray indexOf() Method

The JavaScript indexof() Method is used to find the index of the element provided as the argument to the function.

  • The indexof() method is case sensitive.

Syntax:

Parameters:

Value: Value to be search in the index.

Start: Default 0. At which position to start the search.

Return value:

It returns the index of the search element. If the element cannot to be found in the array, this method returns -1.

Browser Support:

Chrome Yes
Edge Yes
Firefox Yes
Opera Yes

Example 1

JavaScript TypedArray indexOf() Method

Test it Now

Output:

-1

Example 2

JavaScript TypedArray indexOf() Method

Test it Now

Output:

4





Please Share

facebook twitter google plus pinterest

B.Tech / MCA


Learn Latest Tutorials