Note:
1. find() does not execute the function for empty arrays.
2. Does not check the remaining values if returns true
3. find() does not change the original array.
Syntax
array.find(function(curValue, index, arr),thisVal))
currValue : Required. The value of the current element
index : Optional. The array index of the current element
arr : Optional. The array object the current element belongs to
thisVal: Optional.
Example
let numArr = [3, 2, 5, 7, 11, 30]; numArr .find((n)=>{ return n % 2 === 0; }); Output : 2, 30
0 Comments