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.

Ronnelle Torres
5,958 PointsFeedback please - This is how I did the challenge (28 lines).
function print(message) {
document.write(message);
}
var questions_Answers = [
[prompt('How many states are in the united states?'), 50],
[prompt('What is the color of the sky?'), 'blue'],
[prompt("What's the color of apple?"), 'red']
];
var counter=0;
function printResult (questions) {
var correctAnswers='<h2>Questions that you got correct</h2><ol>';
var wrongAnswers='<h2>Questions that you got wrong</h2><ol>';
for (var i=0; i < questions.length; i+=1) {
if (questions[i][0]===questions[i][1]) {
correctAnswers+= '<li> You got question number ' + [i] + ' correct! The answer is '+ questions[i][1] + '</li>';
counter +=1;
} else {
wrongAnswers+='<li> You got question number ' + [i] + ' wrong. The answer is '+ questions[i][1] + '</li>';
}
}
correctAnswers+='</ol>';
wrongAnswers+='</ol>';
print('<p>You got a total of ' + counter + ' correct answer/s out of ' + questions.length +
' questions.</p>');
print(correctAnswers);
print(wrongAnswers);
}
printResult(questions_Answers); ```
2 Answers

Alexander Davison
65,454 PointsWOW That website was amazingly great! 3x Better than I thought it will

jai kathuria
Courses Plus Student 1,335 PointsAccording to me these are the slight changes that must be made to your program.
function print(message) {
document.write(message);
}
var questions_Answers = [
[prompt('How many states are in the united states?'), '50'],
[prompt('What is the color of the sky?'), 'blue'],
[prompt("What's the color of apple?"), 'red']
];
var counter=0;
function printResult (questions) {
var correctAnswers='<h2>Questions that you got correct</h2><ol>';
var wrongAnswers='<h2>Questions that you got wrong</h2><ol>';
for (var i=0; i < questions.length; i+=1) {
if (questions[i][0]===questions[i][1]) {
correctAnswers+= '<li> You got question number ' + [i+1] + ' correct! The answer is '+ questions[i][1] + '</li>';
counter +=1;
} else {
wrongAnswers+='<li> You got question number ' + [i+1] + ' wrong. The answer is '+ questions[i][1] + '</li>';
}
}
correctAnswers+='</ol>';
wrongAnswers+='</ol>';
print('<p>You got a total of ' + counter + ' correct answer/s out of ' + questions.length +
' questions.</p>');
print(correctAnswers);
print(wrongAnswers);
}
printResult(questions_Answers);