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 trialJulie Ann DelaPena
3,716 Pointsvar counter = 0; function doStuff( ) { return counter = 10; }
var counter = 0; function doStuff( ) {
return _____________ counter = 10; }
3 Answers
Benjamin Larson
34,055 PointsHi Julie,
It's looking for the "var" keyword:
return var counter = 10;
The question asked : Finish the code below so that the variable counter inside the function is only accessible inside that function.
Adding the "var" keyword declares the variable within the scope of the function only, so that it will not affect the value of any variable named counter outside of that function, or in another function. Leaving out the "var" keyword would make it a global variable.
Joseph Vincent Trajano
1,933 Pointsi still don't get it can anyone help me with this
Heba Hendy
7,786 Pointsvar
Julie Ann DelaPena
3,716 PointsJulie Ann DelaPena
3,716 PointsThank you so much.