const input = require(‘readline-sync’);
// TODO 2: modify your quiz app to ask 5 questions //
// TODO 1.1a: Define candidateName //
let candidateName = “”;
// TODO 1.2a: Define question, correctAnswer, and candidateAnswer //
let question = 1;
let correctAnswer = 0;
let candidateAnswer = “”;
let questions = ["Who was the first American woman in space? ", "True or false: 5000 meters == 5 kilometers? ", "(5+3)/2*10=? ", "Given the array [8, ‘Orbit’, ‘Trajectory’, 45], what entry is at index 2? ", "What is the minimum crew size of the ISS? "];
let correctAnswers = [“Sally Ride”, “True”, 40, “Trajectory”, 3];
let candidateAnswers = [];
function askForName() {
// TODO 1.1b: Ask for candidate’s name //
candidateName = input.question("What is your name: ")
}
function askQuestion() {
// TODO 1.2b: Ask candidate the question and assign the response as candidateAnswer //
for (let i = 0; i < questions.length; i++) {
candidateAnswers[i] = input.question(${question + i} ${questions[i]} \nYour answer:
);
console.log(Correct Answer: ${correctAnswers[i]} \n
)
if (candidateAnswers[i].toLowerCase() === correctAnswers[i].toLowerCase()){
correctAnswer = 0;
}
}
}
What is your name: Nick
Greetings Nick!
1 Who was the first American woman in space?
Your answer: Sally
Correct Answer: Sally Ride
2 True or false: 5000 meters == 5 kilometers?
Your answer: True
Correct Answer: True
3 (5+3)/2*10=?
Your answer: 40
Correct Answer: 40
/home/runner/assignment-1-candidate-testing-nwalk34/candidate-testing.js:25
if (candidateAnswers[i].toLowerCase() === correctAnswers[i].toLowerCase()){
^
TypeError: correctAnswers[i].toLowerCase is not a function