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 Quiz program

I am working on a quiz application in javascript and am wondering how to do the following: I currently have a program that asks five questions then based on the user's input says how many they answered correctly. What I am wanting is to say the exact questions that they got right and wrong, for example:

"You got four questions correct" question 1 question 2 question 3 question 4

"And one question wrong" question 5

Thanks

2 Answers

Basically, you're going to have to store the correctly answered questions and incorrectly answered questions (or a number reference to them) in an array, and iterate through the arrays once the quiz is finished.

Could you show me how that would look once it is coded? Thanks.