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 ES6 for-of for loops #2

Closed lobax closed 6 years ago

lobax commented 6 years ago

ES5 offers various loop techniques, such as for-in, for(;;), and Array.prototype.forEach(). There are however various drawbacks to each, Array.prototype.forEach() uses a callback (thus you cannot use break or return). for-in is cleaner and more readable than for(;;), but it was designed to work with objects with string keys, not arrays, and has some quirks when used with arrays.

Therefore, the new for-of syntax should be used when possible, since it avoids the pitfalls of for-in while maintaining the same simplicity and readability.

https://hacks.mozilla.org/2015/04/es6-in-depth-iterators-and-the-for-of-loop/

RickardBjorklund commented 6 years ago

No longer needed since assignment 3 is done!