2 comments

[ 2.8 ms ] story [ 13.8 ms ] thread
Good article, but I wanted to point out that the looping and comprehensions stuff isn’t really much different with ES5’s array methods.

The first example can actually be written as the much more readable:

  myArray.forEach(function (item) {
    // do something with item
  });
While the second example can be written as:

  var myNewArray = myArray.map(modify);
(comment deleted)