Beginner JavaScript
Q17 / 100

What does the Array.prototype.reduce() method do?

Correct! Well done.

Incorrect.

The correct answer is B) Reduces an array to a single value by applying a callback cumulatively

B

Correct Answer

Reduces an array to a single value by applying a callback cumulatively

Explanation

[1,2,3].reduce((acc, x) => acc + x, 0) returns 6. The second argument is the initial accumulator value.

Progress
17/100