## 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!

### 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. # Check my code out and comment please. This was how I worked it out, totally different and maybe more difficult approach

```var questions = [ ['How many states are in the United States?', 50],
['How many continents are there?', 7],
['How many legs does an insect have?', 6]
];
var right = 0;
var correct = '<ol>';
var wrong = '<ol>';

function print(message) {
document.write( message );
}

for( i = 0; i < questions.length; i += 1 ) {
if ( parseInt(answers) === questions[i] ) {
right += 1;
correct += '<li>' + questions[i] + '</li>';
} if ( parseInt(answers) !== questions[i] )
{
wrong += '<li>' + questions[i] + '</li>';
}
}

if ( right === 0 || right === 2 ) {
print('You got ' + right + ' question(s) right.');
} else {
print('You got ' + right + ' question right.');
}

print('<h2>' + 'You got these questions correct:' + '</h2>');
print(correct);

print('<h2>' + 'You got these questions wrong:' + '</h2>');
print(wrong);
```

Thank you!

Pretty intuitive approach I can say. Good job.

Well thank you...I could have done better with the naming as he did with the 'question', 'answer', 'response' approach Did you really need the second "if" for checking the un-correctness of the answers? Or was it enough to put an "else" instead?

```if ( parseInt(answers) === questions[i] ) {
right += 1;
correct += '<li>' + questions[i] + '</li>';
} else {
wrong += '<li>' + questions[i] + '</li>';
}
}
```

Nope, I see that it was not necessary, thanks Michal