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

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
215,954 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