Hacker News new | past | comments | ask | show | jobs | submit login

This is the best and cleanest way.

Unless there's a reason to use Array.forEach such as automatic paralellization or some other SIMD-like optimization that can be done that cannot be done in a forloop.

A lot of cargo-cult programming seem to take functional programming to mean programming using the map/reduce/foreach functions, and you end up with shitty code like [...Array(N).keys()].foreach(), just so you can somehow claim that you're doing functional programming.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: