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
SAMUEL LAWRENCE
Courses Plus Student 8,447 PointsQuiz challenge solution part 2
Hi guys, did anyone else notice that in the solution video for the second part of the quiz challenge, that the html variable that Dave created in the first part of the challenge was no longer in his code? yet the program still printed all the html. how is that possible?
SAMUEL LAWRENCE
Courses Plus Student 8,447 PointsOk, so in the first part of the challenge, he created an html variable. time: 01:08 https://teamtreehouse.com/library/javascript-loops-arrays-and-objects/tracking-multiple-items-with-arrays/build-a-quiz-challenge-part-1-solution however, in the second part of the challenge, that variable is no longer there but the code still parses. time: 00:00 https://teamtreehouse.com/library/javascript-loops-arrays-and-objects/tracking-multiple-items-with-arrays/build-a-quiz-challenge-part-2-solution
sorry about not including that in the first message Steven Parker
1 Answer
Steven Parker
243,656 PointsIt is certainly peculiar that the declaration of "html" seems to have gone missing, but even if so it just becomes an implicit global declaration when it is assigned. This is allowed in JavaScript when "strict" mode is not being used, but it is not considered a "best practice". It was probably not intentional.
SAMUEL LAWRENCE
Courses Plus Student 8,447 PointsGotcha! Thanks again man.
Steven Parker
243,656 PointsSteven Parker
243,656 PointsPlease provide a link the the course page, and a time index for the video.