Home » JavaScript TypedArray find() Method

JavaScript TypedArray find() Method

by Online Tutorials Library

JavaScript TypedArray find() Method

The JavaScript find() method is used to get the value of the first element in the array that satisfies the provided condition. The find() method apply the function once for each element present in the array. The function returns a true value, if it is found in the array and does not check the remaining value. Otherwise,it returns undefined.

  • find() does not execute the function for empty arrays.
  • find() does not change the original value.

Syntax:

Parameters:

Value (required): The value of the current element.

Index (optional): The array index of the current element.

Arr: The array object the current element belongs to.

Return value:

It returns the array element value if the elements in the array satisfy the condition, otherwise it returns undefined.

Browser Support:

Chrome 45.0
Edge 7.1
Firefox 25.0
Opera 32.0

Example 1

JavaScript Array find() Method

Test it Now

Output:

14  

Example 2

JavaScript Array find() Method

Test it Now

Output:

Undefined  

You may also like