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.
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.