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

The problem with loops in javascript is that, once you start doing more complicated things than accessing array indices, you run the risk of introducing bugs that don't exist when using a more functional style.

Once you're using closures in your for-loop to prevent everything referring to the last index in the array, you might as well be using map and reduce and all that. Otherwise you end up wasting a lot of time to come up with stuff roughly like this:

    (function(order) { 
      // do something 
    })(orders[i])


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

Search: