JavaScript Episode 2
In this exercise your objective will be to write the following functions:
-
logger(array)
:- takes an array
- logs every element from that array to the console
- should use
forEach
-
toCelsius(temperaturesInFahrenheit)
:- takes an array of temperatures in Fahrenheit
- returns an array of those temperatures converted to Celsius
- should use
map
-
hottestDays(temperatures, threshhold)
:- takes an array of temperatures
- takes a threshhold
- returns an array with every temperature above the threshhold
- should use
filter
-
logHottestDays(temperaturesInFahrenheit, threshhold)
:- takes an array of temperatures in Fahrenheit
- takes a threshhold
- logs only temperatures that exceed the threshold from that array to the console
- logs temperatures in Celsius.
Instructions
Tools
- Install
node
:$ brew install node
- Install
yarn
:$ brew install yarn --without-node
The Files
Fork this repository and clone your fork (make sure you clone it into your development
directory):
$ git clone https://github.com/<your_username>/JSEpisode2.git
Inside you'll find two .js
files:
iterators.js
- this is the file you'll be editingiterators.spec.js
- this is a testing file. It checks that your functions have the features discussed above.
DO NOT EDIT THIS FILE
Running The Tests
Install all the requirements:
- Navigate to the project root (you'll find a file called
package.json
there). - Install the requirments using
yarn install
.
Run the tests:
$ yarn test
This command will run the testing file and test your pairs()
function to make sure it has all the required features.
You'll know when you're done when your code passes all the tests.