DD2480-G9 / metrics-graphics

A library optimized for concise and principled data graphics and layouts.
http://metricsgraphicsjs.org
Mozilla Public License 2.0
0 stars 0 forks source link

Requirement: use arrow functions in place of closures #7

Closed BK239 closed 6 years ago

BK239 commented 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.

RickardBjorklund commented 6 years ago

No longer needed since assignment 3 is done!