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 trialTimothy Mattingly
15,972 PointsWhere does this Variable come from?
I had a snapshot of the code but it was deleted. My question is, on line 45 he passes the function what he refers to as a string variable;
saveSearchString(str);
I can't find any where in the code where this variable is declared. What am I missing here?
1 Answer
Steven Parker
231,275 PointsOn line 45 the function is being defined, not called. The keyword "function" in front of the name is the clue. In the definition, "str" is a parameter and parameters don't need to be declared.
If you look further down at line 79, you can see where the function is called, and it is passed "searchString" as the argument. And "searchString" is declared on line 78 immediately above.
Timothy Mattingly
15,972 PointsTimothy Mattingly
15,972 PointsI see it now. Yeah, I was totally missing where that function was being called. I appreciate the response.