Closed getify closed 11 years ago
Also, possibly needing extra attention... ES6 array comprehensions and generator comprehensions:
var foo = [for (x of [1,2,3]) if (x % 2 == 1) x];
foo; // [1,3]
var foo = (for (x of [1,2,3]) if (x % 2 == 1) x);
foo.next().value + foo.next().value; // 4
ES6 adds a few function syntax variations which drop the "function" keyword and have short-hand grammar instead.
For example:
Namely, arrow functions don't require a
{ }
pair for the function body, so that peculiarity needs to be handled.