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

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: