Closed BK239 closed 6 years ago
Use the shorter arrow function syntax instead of closures. See http://es6-features.org/#ExpressionBodies for an explanation. The following code
odds = evens.map(function (v) { return v + 1; }); pairs = evens.map(function (v) { return { even: v, odd: v + 1 }; }); nums = evens.map(function (v, i) { return v + i; });
should be replaced with
odds = evens.map(v => v + 1) pairs = evens.map(v => ({ even: v, odd: v + 1 })) nums = evens.map((v, i) => v + i)
The new syntax is more convenient, make sure to search for the function keyword and consider using this new syntax if it provides more clarity.
No longer needed since assignment 3 is done!
Use the shorter arrow function syntax instead of closures. See http://es6-features.org/#ExpressionBodies for an explanation. The following code
should be replaced with
The new syntax is more convenient, make sure to search for the function keyword and consider using this new syntax if it provides more clarity.