+1 vote
in JavaScript by
Both the "rduucedRight()" and "reduce()" methods follow which one of the following common operation?

a) inject and fold

b) filter and fold

c) finger and fold

d) fold

1 Answer

0 votes
by

Answer: A

Reason: In JavaScript, the reduce() method reduces the size of the array to a single value. This method executes a provided specific method on each data-item or element of the array in the left to right manner. It stored the value returned by the function in an accumulator. However, it does not execute the provided function on the array's elements, which has no value.

The "reduceRigth()" method does the same work of reducing the array to a single individual value and calls or executes a certain function on each element of the array but in the right to left manner. It also stores the value returned by the function in an accumulator, such as total or result.

So as we can see that both the methods "reduce()" and "reduceRight()" almost do the same work that is known as inject and fold.

...