Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Build a Quiz Challenge (Arrays, Loops) - can't get questions to print

I can't even get my questions to print using the prompt.

``` this is JavaScript

function print(message) { document.write(message); }

var quiz [ ["What is the capital of Florida?", "Tallahassee"], ["What state has Devil's Tower in it?", "Wyoming"], ["What state has the largest coastline?", "Alaska"], ["What state is furthest east?", "Maine"] ] var correctAnswers = 0; var question; var answer; var response;

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

1 Answer

Steven Parker
Steven Parker
229,005 Points

It looks like you're missing an equal sign (=) after "var quiz".

Also, it looks like you tried to quote your code but you didn't have the first line quite right:

  • ``` this is JavaScript :point_left: didn't work, has extra words and spaces
  • ```javascript :point_left: this should work
  • ```js :point_left: so will this