DEV Community

Discussion on: Stop using Array.map() everywhere 🥵

Collapse
 
alfredosalzillo profile image
Alfredo Salzillo

In your last example the forEach is the wrong choice. A reduce would have been better

Collapse
 
seven_77 profile image
Seven

do agree

Collapse
 
suprabhasupi profile image
Suprabha

Yeah, my main POC was to use map method wisely. Try to use other array methods.

Collapse
 
alfredosalzillo profile image
Alfredo Salzillo

Yeah, but a map used wisely would have been better than the for, wrong example

const text = array.map((e, i) => [e,i].join(':')).join('<br>')
Enter fullscreen mode Exit fullscreen mode

Some comments have been hidden by the post's author - find out more