Javatpoint Logo
Javatpoint Logo

JavaScript TypedArray reduceRight() Method.

The JavaScript reduceRight() method reduces the elements of an array into a single value and the returned value of the function is stored in an accumulator and each element in the array (from right-to-left) has to reduce it to a single value.

Note: Calling reduceRight()on an empty array without an initial value is an error.

Syntax:

Parameters:

Total(required): The previously returned value of the function.

CurrentValue(Required): The value of the current element.M

Index(Optional): The index of the current element.

Arr(Optional): The array reduceRight() was called upon.

InitialValue(Optional): A value to be passed to the function as the initial value.

Return value:

Return the reduced single value of the array.

Browser Support:

Chrome Yes
Safari 4
Firefox 3.0
Opera 10.5

Example

JavaScript reduceRight() Method

Test it Now

Output:

RDBMS,C++, python, C, Java, MongoDB





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA