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 trialMatthew Paley
1,298 PointsHmmmmmm? Not sure whats being asked here. Moved var status up outta if but if is now empty. added console.log(status)
Asking for status in if???
function elevatorCloseButton(pushed) { var status = "I'll close when I'm ready.";
if (pushed) {
console.log(status); //not correct here
}
}
elevatorCloseButton(true);
2 Answers
Sage Elliott
30,003 PointsHopefully this thread from earlier will help you out good sir. https://teamtreehouse.com/forum/hoisted-variables-problem
Sage Elliott
30,003 PointsAlways glad to help! Make sure you check the post as being answered so it no longer show up as unanswered.
Code on!
Matthew Paley
1,298 PointsHow is "check the post is answered' done exactly? Click the unsubscribe btn???
Matthew Paley
1,298 PointsMatthew Paley
1,298 PointsAaaaahhhhhh-ha! That clears it up perfectly. Just like the video... simply declare first then assign the value later. Makes sense. Thx Sage!