DEV Community

Discussion on: JavaScript’s Reduce Method Explained By Going On a Diet

Collapse
 
lucasmonstro profile image
Lucas Silva

let total = foods.reduce((sum, {calories}) => sum + calories, 0); // Single line

Collapse
 
sara__cruz profile image
Sara Cruz

I don't fully understand why there is a 0 after the parameters, could you explained please? :)