Skip to content

re: JavaScript’s Reduce Method Explained By Going On a Diet VIEW POST

re: The quoted result from the last reduce /*total object is {calories: 2100, carbs: 60, fat:65} */ is actually // { name: 'steak', calories:...

Hey 1hko, thanks for your thorough response! I learned quite a few things from it that I didn't know :)

I wrote this as the first resource that someone should read when they want to learn reduce, so it is always tough for me to figure out how much to specify in there vs. how much they will need to learn on their own.

I added a final code block with the initial value for the object and an explanation on why you need to create an initial value. I think you are right, the previous version would have led people into a trap potentially.


I agree it's very challenging to determine how much information to include. It's easy to overwhelm the learner!

I'm happy to have contributed to your post. Happy to discuss any time.

code of conduct - report abuse