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 built-in method for finding array elements #12

Closed BK239 closed 6 years ago

BK239 commented 6 years ago

Instead of using the traditional filter method with a closure, use the new methods find and findIndex for searching an element in an array! The code below

[ 1, 3, 4, 2 ].filter(function (x) { return x > 3; })[0]; // returns 4

should be replaced by the following:

[ 1, 3, 4, 2 ].find(x => x > 3); // returns 4

Make sure these methods are used, keep in mind however that they are not always applicable since find only returns one element as opposed to a list.

RickardBjorklund commented 6 years ago

No longer needed since assignment 3 is done!