Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In modern JS (easily polyfilled), there are map, reduce, filter, and forEach for this. These have the further advantage of being more easily chained; however they're a lot slower too.

One downside of coffeescript's loop comprehensions is that they generate fairly complex code whenever you use them in non-trivial ways, thus undermining coffeescript's key feature: easily readable (and debuggable) javascript.



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

Search: