Assignment #1 Getting the question asked and getting the answers correct. Been a struggle

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

if (candidateAnswers[i].toLowerCase() === correctAnswers[i].toLowerCase()){

TypeError: correctAnswers[i].toLowerCase is not a function

Share your repl link

My function askQuestion() only loops thru the length of questions array and prompt (asks) questions of user (like the askForName() function but for an array) and does not print anything. My function gradeQuiz(candidateAnswers) - this brings in candidateAnswers - loops thru length of candidateAnswers array and prints 1) questions and answers 2) tests for (if) and counts (correct = correct +1) the correct answers plus…
Where your code: if (candidateAnswers[i].toLowerCase() === correctAnswers[i].toLowerCase()){ - is placed does not make sense to me as your candidateAnswers array is not filled up yet. Hope this helps - I’m new at this.

share your link so I can take a look at it.

I looked at you code and I want to encourage you to go and watch the videos on assignment 1 walk through. You need to refine your structure and those videos will help. You can find them in slack #javascript-helpful-videos.

Is there a way to start over. Still feeling lost. Like nothing from the beginning has sinked in. I didn’t do well on For Loops and it seems to be used alot