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 trialDinu Comendant
6,049 Points8:40 is soooo confusing
I've been looking at several answers in the community section but I still don't understand why label is out of scope of the checkbox. Would someone maybe be able to map it out of why label is out of scope?
1 Answer
Dinu Comendant
6,049 PointsI think I start to get it, but just to be sure: Basically, the function itself is in a way creating a variable, and the return statement works more or less as declaring it like 'const element = example' for others to see it?
Reggie Williams
Treehouse TeacherYou're on the right track! The element variable is defined earlier in a statement in the function body but the return statement gives other functions access to it
Dinu Comendant
6,049 PointsThanks a lot, Reggie!
Reggie Williams
Treehouse TeacherReggie Williams
Treehouse TeacherHey Dinu Comendant previously the label was being stored in the
label
variable, now it's being appended to the page without being stored in the variable as before. This leads Guil to return label so he has access to it.