JavaScript Array find()

The JavaScript array find() method is used to return the value of the first element in the given array that satisfies the specified condition.


array.find (callback (value, index, arr), thisArg)

Parameters: callback: It represents the method to test the condition. It is required. currentValue: It represents the array’s current element. It is required. index: Current element index. It is optional. arr: It represents the array on which every() method is to be invoked. It is optional. thisArg: It is used as this keyword while executing callback. It is optional.

Returns: Array’s first element that satisfies the function condition.


<!DOCTYPE html>
var result=a.find(x=> x>"GOLD");
Please follow and like us:
Content Protection by