Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 :)