DEV Community

loading...

Discussion on: How to get every item in an array for beginners.

Collapse
bakedbird profile image
Eleftherios Psitopoulos

Is there any specific reason you chained map and forEach on the third method that I am missing?

Collapse
w6 profile image
w6 Author

No, each method chained together is another iteration over the array.

Collapse
bakedbird profile image
Eleftherios Psitopoulos

Yes, I’m just asking because I don’t think it’s really needed there, unless you’re planning to return the array.

Thread Thread
w6 profile image
w6 Author

Thank you for the feedback!