JS iterables Flashcards

1
Q

What is the reduce method?

A

The reduce() method is used to apply a function to each element in the array to reduce the array to a single value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the reduce method syntax?

A
let sum = arr.reduce((acc, val) => acc + val, 100);
//100 is added to the sum, is the starting point.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly