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

So the forEach magic that is so much faster is... a normal for loop:

  exports.forEach = function fastForEach (subject, fn, thisContext) {
    var length = subject.length,
        i;
    for (i = 0; i < length; i++) {
      fn.call(thisContext, subject[i], i, subject);
    }
  };
I knew that forEach was slower than a normal for loop but I was expecting something more.


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

Search: