In the iterators lab we will be continuing our exploration of iterators. We have a series of challenges that require you to use the iterators we discussed in class. We will try to use various testing methods to verify that your code is working.
Research the following term and summarize your findings on it two to three sentences:
higher-order function
Update this README with a description of each of the following and an example you've created:
Use the notes provided to help guide you explanation.
- Run
npm install
from theiterators_lab
directory. - Looks at the tests we've written in the
test
folder. Run the tests withnpm test
(also from theiterators_lab
directory). They should all fail. - Get all of the tests to pass by writing the necessary code in
src/iterators.js
.
Refactor the following code using map
to make only one call to the map
function versus the two below.
var myNumbers = [ -1, 2, -3, 4, -5, 6];
var square = function(num) {
return num * num;
};
var sqrRoot = function(num) {
return Math.sqrt(num);
};
var sqrNumbers = map(myNumbers, square);
var absNumbers = map(sqrNumbers, sqrRoot);