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 JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Build a Quiz Challenge, Part 1 Solution

Part 1 solution Is this work fine ?

var question = [ ["This is question 1","a1"], ["This is question 2","a2"], ["This is question 3","a3"] ]; var correctAnswer = 0;

for (var i = 0 ; i < question.length; i +=1) { if (prompt (question[i][0]) === question[i][1]) { correctAnswer += 1 } };

print ("You got " + correctAnswer + " question (s) right");

Tim Strand
Tim Strand
22,458 Points

i dont see a question posed in this. 1) what is your question 2) correctly format your code using the Markdown Cheatsheet

1 Answer

Steven Parker
Steven Parker
229,644 Points

It sounds like you're asking if your code operates correctly. You can probably make this determination for yourself, but the one issue I see is that you have not yet defined the "print" function.

Otherwise, it looks good.