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 trialdiannalord
7,284 PointsIn the bindTaskEvents function, are the parameters "taskListItem" and "checkBoxEventHandler" also local variables?
Andrew types "taskListItem" and "checkBoxEventHandler" as the parameters, but the names of these parameters did not exist until written as part of the function. It seems that the function creates the names of the parameters "taskListItem" and "checkBoxEventHandler".
Are these names also considered to be local variables?
I should just go review training on creating functions to get clear on parameters.
1 Answer
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsHi Dianna,
If a variable is declared in a function the variable scope is binded to that function only.
If a variable is declared outside a function the variable scope jumps to global -> any function you write, it can see the variable and interact with it: HEADS UP -> be careful with those, if you change the value in a function it value is changed globally.
Hope this shines some light. If not I can send you a flashlight :)
diannalord
7,284 Pointsdiannalord
7,284 PointsThanks!