Check out a free preview of the full Complete Intro to Web Development, v2 course:
The "Scope Exercise" Lesson is part of the full, Complete Intro to Web Development, v2 course featured in this preview video. Here's what you'd learn in this lesson:

After noting where the variable is declared, students work through code example to find where there are problems with scope in this exercise.

Get Free Access Now

Transcript from the "Scope Exercise" Lesson

[00:00:01]
>> Brian Holt: So I want you to take, maybe, a couple of minutes here, two or three or max. Don't look at the answer down here. And I want you to go through this convoluted mess that I made for you on purpose. [LAUGH] This is bad programming on purpose. And I want you to kinda figure out, it's like, okay, that looks like it should work, that should work, that won't work, this should work.