JavaScript Array reduceRight()
JavaScript Array reduceRight()
The reduceRight() method is used to execute a reducer function for each array element. It works from right to left. It returns a single value which is the function accumulated result. It will not execute the function for empty elements.
Syntax:-
Its syntax is:- array.reduceRight(function(total, currentValue, currentIndex, arr), initialValue)
Return:-
Its return is:- The accumulated result from the last call of the callback function.
Further Explanation:-
Parameter | Description | ||||||||
function() | Required. A function to be run for each element in the array. | ||||||||
Reducer function parameters:
|
|||||||||
initialValue | Optional. A value is to be passed to the function as the initial value. |