learn-js/jsintro_pt3 #135
Replies: 1 comment
-
In the second example of the Array's reduce method, I get the following error from the compiler: Array.prototype.reduce() expects a return value from arrow function. var monstersInTheLevel = waves.reduce((currentStats, wave) => { The solution is to add a return to the end of the internal anonymous function: var monstersInTheLevel = waves.reduce((currentStats, wave) => { return currentStats; // THE MISSING PIECE. }, {}); // Start with an empty object |
Beta Was this translation helpful? Give feedback.
-
learn-js/jsintro_pt3
Introduction to JavaScript, part III: Objects and Arrays, in-depth Objects Everything in JavaScript is an object! Except for true, false, simple numbers and strings, null, and u...
https://docs.ctjs.rocks/learn-js/jsintro_pt3.html
Beta Was this translation helpful? Give feedback.
All reactions