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.

JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Build a Quiz Challenge, Part 1 Solution

First part of the challenge and I don't even get the pop-up, whats wrong with my code?

Don't know if this is how you do a snapshot but here it is: https://w.trhou.se/q8msfg8xef

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hej Nathalie Agnekil! You have a bit of a typo in your for loop which is causing things to go a bit bonkers.

You wrote:

  for ( var i = 0; i = questionList.length; i += 1)

But you meant to write that middle part as an expression instead of an assignment:

  for ( var i = 0; i < questionList.length; i += 1)

Note that the second equals sign changes to a less than sign. Hope this helps! :sparkles:

Yes I saw that after posting, changed it, and it didn't help..

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Odd. Changing it fixed it for me. The problem being that it's now assigning the length of the array to [i]. But the length is 5. And there is no element in the array at an index of 5. It only goes up to four because it starts numbering at 0.

My best guess here is that you have either not saved your work, or the browser is loading in a cached version of your code. If you confirm that your work is saved and refresh and it still doesn't work, the next step would be to try clearing your browser cache and see if that helps! :sparkles: