- 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-allto 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
greetingand give it the value 'Hello'. - Create a variable named
sumand give it the value 0. - Create a variable named
prodand give it the value 0. - Create a function named
greetthat will take one parameter (of type string). The function will change the value ofgreetingto 'Hello' followed by a space followed by the value of the parameter. - Create a function named
sumOfTwothat will take two parameters (of type number). The function will change the value ofsumto be equal to the sum of the two parameters - Create a function named
multiplythat will take three parameters (of type number). The function will change the value ofprodto be equal to the product of the three parameters.
-
Create a function named
sayHithat will take one parameter and return a personalized greetingINPUT: sayHi("Charlotte");
OUTPUT: "Hello Charlotte!";
INPUT: sayHi("Colin");
OUTPUT: "Hello Colin!";
-
Create a function named
returnWhatISaythat 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
dividethat will take two parameters and return the resultINPUT: divide(10,5);
OUTPUT: 2;
-
Create a function named
remainderthat takes two parameters and return the remainder that we get when those two numbers get dividedINPUT: remainder(10,3);
OUTPUT: 1;