One partner should fork this repo. Then after it's been forked, add the other partner(s) as collaborators. Afterwards, all group members should be able to clone down the forked repository and all group members should be able to push
and pull
from that repository.
Work with your partner to implement the below functions using pair programming! For each exercise, one partner should be the Navigator and the other should be the Driver.
- Navigator should describe what the function should do.
- Describe, in plain English, what the function should take in as a parameter and what it should console.log or return.
- Driver writes out the test cases.
- For each problem, invoke the function with a parameter and describe the expected results.
- We've suggested some test cases for the some of the problems, but you should come up with some of your own, too!
- Navigator explains how to implement the function while Driver writes the code so those test cases pass!
- Driver does some refactoring if needed, or adds additional test cases if needed.
Switch roles for each of the problems below.
- You should manually test your code by running the program. From the project's root directory, type
node app.js
in the terminal and see if the program does out what you expect it to. - You should also run the automated test cases built into this lab.
- From the project's root directory, type and run
npm install
in your terminal. You only need to do that once. - Then, every time you want to run the automated test cases, run
npm test
in the terminal.
- Write a function called
makeNegative
that takes in one parameter, a numbers, returns the negative version of that number.
makeNegative(2);
// => -2
makeNegative(3);
// => -3
- Write a function called
printAddition
that takes in two parameters, both are numbers, and logs a sentence describing the sum of those numbers.
printAddition(1, 1); // The sum of 1 and 1 is 2.
printAddition(2, 3); // The sum of 2 and 3 is 5.
printAddition(4, 5); // The sum of 4 and 5 is 9.