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 trialSteve holcomb
1,931 PointsI cant seem to get this one correct. What am I missing?
What am I missing here?
var returnValue = function (blah) {
return blah;
var echo = blah
};
returnValue("yo");
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
1 Answer
Connor Walker
17,985 PointsThe problem is that the challenge wanted the echo variable to be created outside of the function that you had created, but yours was inside it instead. Also because the return statement immediatly stops that function and returns to wherever called it, it would never actually be created.
To set the variable echo to the value of the function all you need to do is declare the variable and then call the function, like this:
var returnValue = function (blah) {
return blah;
};
var echo = returnValue("yo");