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

Hui Zheng
PRO
Hui Zheng
Pro Student 1,380 Points

My code wouldn't produce the same result

I only made a small change to the example from the video, instead of having the assignment of the response variable in 2 separate statements I combined them into one single statement. Besides that, I had typed everything else verbatim and had re-watched the video three times to make sure I had no typos on my code. But I couldn't figure out what I had done wrong and how come I was not able to get the same result.

Here is the link to what I had done: https://teamtreehouse.com/workspaces/40977780#

Steven Parker
Steven Parker
173,944 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.

1 Answer

Steven Parker
Steven Parker
173,944 Points

I found "index.html" inside the "css" folder, so before it would run I had to move it to the main folder.

Then I discovered two issues in "quiz.js":

  • the assignment on line 23 should be a concatenating assignment instead ("+=")
  • around line 36, a closing bracket is missing to complete the "for" loop (that starts on line 27)
Hui Zheng
Hui Zheng
Pro Student 1,380 Points

I did move the index.html file down to the js folder. On line 23 I did it according to how it was done in the video by closing the ol tag. On line 36, I went back and added the closing bracket nonetheless I still didn't get the result I expected.

Here is the link -- https://w.trhou.se/s8xm70sosp

Steven Parker
Steven Parker
173,944 Points

The index file needs to be in the root folder, not in either subfolder. Once I moved it up, the program ran as expected for me.