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 Loops, Arrays and Objects Tracking Multiple Items with Arrays Build a Quiz Challenge, Part 1 Solution

Charlotte Zhang
Charlotte Zhang
4,425 Points

Please help, it just won't track anything, correct answer or wrong answer!

So I was doing this (https://teamtreehouse.com/library/build-a-quiz-challenge-part-1) challenge. Drag the video to the 00;26 if you want to know what I am trying to build. Long story short, I was suppose to build a two-dimensional array, that contains three questions and their answers. And I should prompt those questions, collect inputs, and evaluate if the inputs are correct. I should also keep track of the number of correct and wrong answers, and print them to the webpage. And this is what I have done(js/quiz.js): https://teamtreehouse.com/workspaces/29326122. It runs, and when I enter the console, it shows nothing, not mistake or anything. But it just won't track anything, no matter how you answer those question, the page will tell you you get 0 correct and 0 wrong answer!. Please help me, I really don't know what I did wrong.

Steven Parker
Steven Parker
229,644 Points

You can't share a direct URL to your workspace, it's temporary and only exists while you are using it
But you can use the snapshot function in the workspace and provide the link to that.

2 Answers

Steven Parker
Steven Parker
229,644 Points

Good snapshot! Now I can see the issue: when the messages are created, "correct" and "wrong" still have the starting values of 0. But if you move the lines that create the messages so that they come after the program loop, then the messages will show the final values instead of the starting values.