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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Matthew Riggs](https://secure.gravatar.com/avatar/d24d4bb9198c385628bbeedd26e5672c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Matthew Riggs
826 PointsConfused about constructer scope order
In the constructer in line 4, before he started talking about naming multiple objects the same thing, (around 5:00ish) the string "name" isn't defined, so how did it compile? Or was it defined and I missed it?
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsBefore 4:30, "name" was defined as the parameter on line 4, and it was used on line 5.
Both the parameter and the reference get changed to "characterName" between 4:30 and 4:55. In between those two changes, the code would not compile. But no attempt to compile is made while the editing is incomplete.
Matthew Riggs
826 PointsMatthew Riggs
826 PointsSo if he had tried to compile it before the change to 'this.characterName' it would not have compiled because 'name' hadn't been declared or defined before it was being used as a definition for 'characterName', but since he didn't try to compile it there and instead fixed the issue before it came up the compilation problem never came up. Am I understanding correctly?
Steven Parker
230,688 PointsSteven Parker
230,688 PointsRight. in that section between 4:30 and 4:55 changes are still being made and the code isn't ready to be re-compiled yet.
Matthew Riggs
826 PointsMatthew Riggs
826 PointsGot it, thank you very much!