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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![alan heath](https://uploads.teamtreehouse.com/production/profile-photos/108587/micro_profilepic.jpg)
alan heath
5,188 Pointsokay...what am i doing wrong
So have put the var status above the if statement but then what next? I keep getting "you should assign the "status" in the if statement so i copied the example and placed within the if statement also here is what i have so far:
function elevatorCloseButton(pushed) {
var status = "I'll close when I'm ready.";
if (pushed) {
status = "I'll close when I'm Ready";
console.log (status)
}
elevatorCloseButton(true);
2 Answers
![James Barnett](https://secure.gravatar.com/avatar/43ea08b4fc547e8a5da87c207bea2123?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
James Barnett
39,199 Pointsalan heath - The issue with your code, is you want to only set the status if the button has been pushed, not before.
![Jeff Busch](https://uploads.teamtreehouse.com/production/profile-photos/306482/micro_Ben_Franklin_510_copy_02.jpg)
Jeff Busch
19,287 PointsHi Alan,
You're close:
function elevatorCloseButton(pushed) {
var status;
if (pushed) {
status = "I'll close when I'm ready.";
}
}
elevatorCloseButton(true);
If you look to the bottom right of the text box you will see something that says Markdown Cheetsheet. If you don't understand that maybe this will make sense: How to display code at Treehouse
Jeff