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 trialJacob Tennyson
6,240 PointsChallenge Task 1 of 1
Not sure im understanding what alter means...
<!DOCTYPE html>
<html lang="en">
<head>
<title> JavaScript Foundations: Variables</title>
<style>
html {
background: #FAFAFA;
font-family: sans-serif;
}
</style>
</head>
<body>
<h1>JavaScript Foundations</h1>
<h2>Variables: Hoisting</h2>
<script>
function elevatorCloseButton
function status(pushed) {
if (pushed) {var status = "I'll close when I'm ready.";}}
elevatorCloseButton(true);
</script>
</body>
</html>
1 Answer
Shawn Flanigan
Courses Plus Student 15,815 PointsJacob,
This section is about hoisting your variables in your functions (basically declaring them at the top of the scope). They're just asking you to declare your variable (status
) at the beginning of the function, then actually set its value within the if
statement.
Hopefully this makes sense, but let me know if you need more direction.
Jacob Tennyson
6,240 PointsIm still confused
Jacob Tennyson
6,240 PointsJacob Tennyson
6,240 PointsAlter the 'elevatorCloseButton' function to follow the best practices in declaring variables within the scope of the function.