array.find(function(currentValue, index, arr),thisValue);
Parameters: This method accepts 5 parameters as mentioned above and described below:
- function: It is the function of the array that works on each element.
- currentValue: This parameter holds the current element.
- index: It is an optional parameter that holds the index of the current element.
- arr: It is an optional parameter that holds the array object to which the current element belongs to.
- thisValue: This parameter is optional. If a value is to be passed to the function to be used as its “this” value else the value “undefined” will be passed as its “this” value.
Return value: It returns the array element value if any of the elements in the array satisfy the condition, otherwise it returns undefined.
- Google Chrome 45.0
- Microsoft Edge 12.0
- Mozilla Firefox 25.0
- Safari 7.1
- Opera 32.0