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

Immanuel Jaeggi
Immanuel Jaeggi
5,164 Points

only see blank screen

Could you run through my code quickly? Results can't be seen. txs.

var quiz = [ ['What comes after 99?', 100], ['If you multiply 5 by itself, what do you get?', 25], ['How many litres of blood are there in the human body?', 40] ]; var correctAnswers = 0; var question; var answer; var response: var html;

for (var i = 0; i < quiz.length; i += 1 ) { question = quiz[i][0]; answer = quiz[i][1]; response = parseInt(prompt(question)); if (response === answer) { correctAnswers += 1; }

html = 'You got ' + correctAnswers + ' answers right.'; print(html);

1 Answer

If you run this through the console you'll see unexpected token on line 5.

On line 5 you end with a colon instead of a semicolon

var response: