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 […]
Tag: loop
FCC Bonfire Series 137: Everything be true
Today, we’ll deal with objects, for objects are wonderful! Everything be true will have us write a function that takes in 2 arguments. The first will be an array of objects (also called a collection), and […]
FCC Bonfire Series 135: Steamroller
This time, I bring a few solutions for the Steamroller bonfire. This guy has been a problem for many campers before, as it deals with recursion, a concept that may take some time to understand properly. […]
FCC Bonfire Series 134: Drop it
I come in with a short one today, similar to the last bonfire, Drop it will have use dealing with arrays and truth tests. This time, we need to drop elements of an array passed in as the […]
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…