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 trialKris Byrum
32,636 PointsCode Challenge Help Please
So i'm lost and i need a little help.
The teacher is not very clear in some of his presentations compared to the other two.
The questions and challenges in this module are also a little unclear from what I know and what has been taught so far.
Can someone help me figure out what they are looking for here please?
I've already declared the var status under the function. It was originally in the if statement.
Thanks in advance!!
Alter the 'elevatorCloseButton' function to follow the best practices in declaring variables within the scope of the function
function elevatorCloseButton(pushed) {
var status = "I'll close when I'm ready.";
if (pushed) {
status = "I'll close when I'm ready.";
}
}
elevatorCloseButton(true);
2 Answers
Kevin Kenger
32,834 PointsWhat you have right now is close, but it's just asking you to declare the variable, and not assign it a value. So it should be something like this:
function elevatorCloseButton(pushed) {
var status;
if (pushed) {
status = "I'll close when I'm ready.";
}
}
Kris Byrum
32,636 PointsKevin thank you so much.
Kevin Kenger
32,834 PointsMy pleasure dude :)