JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Build a Quiz Challenge, Part 1 Solution

Correct answers are not counted.

I followed along with the video multiple times and keep running into the same problem. Even when I type the correct answers to the quiz, it always says I got "0 correct answers".

var array = [
  ['What is the color of the sky?', 'blue'],
  ['What is your name?', 'bob'],
  ['What day is it?', 'friday']

var i;
var correctAnswers = 0;
var question;
var answer;
var response;
var html;

function print(message) {

for (i = 0; i < array.length; i += 1) {
  question = array[i][0];
  answer = array[i][1];
  response = prompt(question);
  response = response.toLowerCase;
  if (response === answer) {
    correctAnswers += 1;

html = "You got " + correctAnswers + " question(s) right.";

1 Answer

Liv Larsen
Liv Larsen
1,799 Points

Hi Zach, ".toLowerCase" is a method, meaning you're missing the "()" at the end. Try this adding them like this: "response = response.toLowerCase();

It should solve your problem :)