Like last time, there are two parts to this problem set:
- A written response section
- JavaScript small problems1
To complete and submit this problem set, you will...
- Your written response questions live in the
short-response.mdfile. Record your answers without removing the original questions. Use complete sentences and style appropriately with markdown. - Your small problems are in the
problemsdirectory. The directory contains these files:README.mdanswers.jsindex.htmlanswers.test.js
The problem prompts are in README.md. You are to write your solutions in the answers.js file. You are to write your code inside the existing function declarations.
Example:
// Question 1
function thisIsAnExample() {
return true;
}I included the index.html file for you so that you can run your code in the browser and use Chrome Dev tools.
This is our first problem set with unit tests. Unit Testing is a way to ensure that your code functions as intended by breaking it up into smaller components and testing each part, independently. We will talk more about unit tests in the future. In fact, you will eventually write your own.
For now, just follow these steps to test your code using the tests that I wrote.
- When you are ready to run your first test, run
npm installin the terminal. Think of this command as "installing" the tests. - Now, each time you want to run tests, run
npm testin the terminal. When you run the test suite, you will see some helpful information in the output. It will tell you which tests passed and failed and what the expected results of each of the tests were. Only when you have gotten all tests to pass can you submit this assignment. - Commit frequently.
- When you are finished, push your changes to your remote repo and submit the URL thorugh Canvas.
1: Exercises adapted from Launch School small problems and Code Wars katas.