Simple Javascript Reduce Tutorial - By making banana bread
Barely Coding with Daniel Bark
In this tutorial i explain the javascript array method reduce. I show how to sum and multiply numbers, and then i show how to bake banana bread using reduce. Reduce looks over the array items but also keeps an accumulated value passed into every iteration of the loop. What is returned from the callback becomes the accumulated value in the next iteration. The value returned from the last loop interation becomes the returned value from the reduce call. Reduce does not modify the array it is called on.
Link to the code: https://gist.github.com/danba340/b353da579019ed3698f71a675d809080
Say hi on twitter: https://twitter.com/barelydaniel
0:00 Intro 0:25 How reduce works 1:40 How to sum a list of numbers 3:05 How to multiply a list of numbers 4:15 Baking banana bread with reduce 10:53 Best regards ... https://www.youtube.com/watch?v=vEcpy3tBBxQ
51343088 Bytes