Tag: loop

FCC Bonfire Series 140: Map the Debris

Today’s bonfire, once again, will have us deal with objects. This time, in Map the Debris, we must write a function that, given an array of elements (satellites) and their average altitudes, must return their […]

FCC Bonfire Series 133: Finders Keepers

Time for a new bonfire it is, this time, we’ll fight our way through Finders Keepers. This bonfire will have us create a function that takes two arguments; The first will be an array, and the second a will be truth test (a function that returns true/false). Our function must return the first item in the array that passes the test.

Free Code Camp hints at the using of the Array.prototype.some() method, and that’s where we are going to be starting, but we will also create a less functional version that, will, once again, be quite faster.

The Array.prototype.some() method will iterate over an array and execute a callback (function) over each item until one of them returns true. Once an item has passed the test, some() will return true; if no item passed, then, it is false. But…