Michael Timbs
1 min readSep 27, 2020

--

Interesting read. It’s fascinating how code opinions vary from developer to developer. I find reduce easier to read than forEach and in all cases in your article prefer the reduce implementation.

Still, I appreciate that a lot of people find it hard to intuit reduce.

The big downside for me with using forEach is that it’s not obvious if something is being mutated. I’d much rather a reducer than to see an array push inside a loop. You did acknowledge that immutability is a big deal for some people and I agree that if you don’t dislike mutating things then forEach is valid.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Michael Timbs
Michael Timbs

Written by Michael Timbs

Full-stack developer. In love with Typescript and Serverless

Responses (2)

Write a response