Part 2: Multiple Questions
Now that your small app is working, expand it to deal with multiple questions. This time, you only have one
TODO item in the starter code. You will need to determine which lines need to be modified.
correctAnswersvariables as arrays. Use the table below to fill these arrays.
Replace your code from
TODO 1.2bwith a loop that programmatically asks each question in the array and stores the user’s responses.
Replace the basic feedback from
TODO 1.2cwith a template literal that displays each of the candidate’s responses in addition to the corresponding correct answers.
|Who was the first American woman in space?||“Sally Ride”|
|True or false: 5 kilometer == 5000 meters?||“true”|
|(5 + 3)/2 * 10 = ?||“40”|
|Given the array ||“Trajectory”|
|What is the minimum crew size for the ISS?||3|
Keep the questions and correct answers stored in this exact order.
Make sure your loops work properly before moving on to part 3.
This is also a great time to save, commit, and push up your work.
Testing Part 2
In the terminal run
npm test. This will run the autograding tests. The results will display in the terminal.
To pass Part 2, you need to pass tests 7-10.
You should still pass tests 1-6 from Part 1.
Move on to Part 3