- Navigate to this directory in your terminal.
- Run
code .
to open the project in VS Code. - Open
main.test.js
(you can use Command-P to start typing in the name!). - In a terminal (preferably a full-screen one), run
jest --watch-all
to start testing.
You'll be working in main.test.js
, creating the variables needed with the values asked for, according to the specifications given in the tests. Check your terminal for feedback on which aspect of the problem you have yet to complete, and read the specifications' actual code implementation for extra help; it makes explicit exactly what outputs are expected given the test inputs.
- Please do not call the functions; just declare them! You can call them to check for your own testing purposes, but then either delete or comment out the line.
- Create a variable named
greeting
and give it the value 'Hello'. - Create a variable named
sum
and give it the value 0. - Create a variable named
prod
and give it the value 0. - Create a function named
greet
that will take one parameter (of type string). The function will change the value ofgreeting
to 'Hello' followed by a space followed by the value of the parameter. - Create a function named
sumOfTwo
that will take two parameters (of type number). The function will change the value ofsum
to be equal to the sum of the two parameters - Create a function named
multiply
that will take three parameters (of type number). The function will change the value ofprod
to be equal to the product of the three parameters.
-
Create a function named
sayHi
that will take one parameter and return a personalized greetingINPUT: sayHi("Charlotte");
OUTPUT: "Hello Charlotte!";
INPUT: sayHi("Colin");
OUTPUT: "Hello Colin!";
-
Create a function named
returnWhatISay
that will take a string sentence and returns that sentenceINPUT: returnWhatISay("Hello students, how are you");
OUTPUT: "Hello students, how are you";
-
Create a function named
divide
that will take two parameters and return the resultINPUT: divide(10,5);
OUTPUT: 2;
-
Create a function named
remainder
that takes two parameters and return the remainder that we get when those two numbers get dividedINPUT: remainder(10,3);
OUTPUT: 1;