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.

Raul Cisneros
7,319 PointsHavent been able to figure out how to incorporate the "for" loop, but its still somewhat working.
var quizQuestions = [
["How many eggs in one dozen?", 12],
["How many numbers on a telephone key pad?", 10],
["How many stars in our solar system?", 1]
];
var incorrect = 0;
var correct = 0;
var ques1 = prompt(quizQuestions[0][0]);
if (parseInt(ques1) === 12) {
correct++;
} else {
incorrect++;
}
var ques2 = prompt(quizQuestions[1][0]);
if (parseInt(ques2) === 10) {
correct++;
} else {
incorrect++;
}
var ques3 = prompt(quizQuestions[2][0]);
if (parseInt(ques3) === 1) {
correct++;
} else {
incorrect++;
}
document.getElementById("link").innerHTML = ("You had a total of " + correct + " correct answers.");
document.getElementById("link2").innerHTML = ("You had a total of " + incorrect + " incorrect answers.");
1 Answer

Steven Parker
221,310 PointsHere's a few hints:
- where you have 3 very similar sections of code you can use one loop instead
- the body of the loop would be similar to just one of the three sections
- you could use the loop index to select which question to show
- instead of a fixed value, you could also use the loop index to pick the value to compare with
If you still can't get it, proceed to the next video and see the teacher's example.
Raul Cisneros
7,319 PointsRaul Cisneros
7,319 PointsBeen burning too much time on this. Figured I better throw in the towel.