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 trialTani Huang
6,952 PointsPart 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");
1 Answer
Steven Parker
231,275 PointsIt 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.
Tim Strand
22,458 PointsTim Strand
22,458 Pointsi dont see a question posed in this. 1) what is your question 2) correctly format your code using the Markdown Cheatsheet