16.7: Array Functions: reduce() – Topics of JavaScript/ES6




In this video, I cover the JavaScript array function reduce().

🎥 Next Video: https://youtu.be/qmnH5MT_luk

🔗 MDN’s Array Documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

🚂 The Coding Train website: http://thecodingtrain.com/
💖 Support this channel on Patreon: https://patreon.com/codingtrain
🛒 To buy Coding Train merchandise: https://www.designbyhumans.com/shop/codingtrain/
📚 Book recommendations: https://www.amazon.com/shop/thecodingtrain

💻 https://github.com/CodingTrain/Rainbow-Code

🎥 For an Introduction to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
🎥 For More Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

🔗 https://p5js.org/
🔗 https://processing.org

📄 Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct

Original source


40 responses to “16.7: Array Functions: reduce() – Topics of JavaScript/ES6”

  1. Honestly, I've been trying to understand HOFs that use HOFs and all kinds of mind numbing stuff for a guy who has just started learning JS in the past few months. Thank god I found this crazy dude. He is the funniest / most entertaining I've found so far.

  2. I was trying to see the difference between your reducer example and just using a map function, but I guess that is where the accumulator comes in. The accumulator persist over all the iterations where in a map function, you would have to create a variable outside the function and in each iteration of the map function you could do math on that variable and change it accordingly but the reducer function provides that extra variable and allows you to use on each iteration. Nice. Thanks!!

Leave a Reply