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 Arrays Multidimensional Arrays Build a Quiz Challenge – One Solution

Paige Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Paige Christensen
Data Analysis Techdegree Student 2,995 Points

I am having an issue with my prompt displaying.

Here is the code I copied along with the video, but when I previewed it, there is no prompt. I believe it's probably a syntax issue but I am having trouble finding it.

const questions [ ['How many planets are in the Solar System?', '8'], ['How many continents are there?', '7'], ['How many legs does an insect have?', '6'], ['What year was JavaScript created?', '1995']
];

let correctAnswers = 0;

for ( let i = 0; i < questions.length; i++ ) { let question = questions[i][0]; let answer = questions[i][1]; let response = prompt(question);

if ( response === answer) { correctAnswers++; } }

1 Answer

In the line const questions [ ['How many planets are in the Solar System?', '8'], ['How many continents are there?', '7'], ['How many legs does an insect have?', '6'], ['What year was JavaScript created?', '1995'] ]; you are missing an equal sign after questions.