DEV Community

Discussion on: Can you solve this JavaScript problem?

Collapse
 
varundey profile image
Varun Dey

We definitely can. But as I said, I always get confused with the argument order of reduce and since I didn't want to Google my way through this one, I went with forEach

Collapse
 
sadarshannaiynar profile image
Adarsh

I used to struggle as well but with practice you will get the hang of it. Once you start using array methods you can get lot of things with as little code as possible.