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 trialKim Dallas
11,461 Pointsthe var is echo
what am I missing
function returnValue(value)
{
return value;
}
var echo
return echo;
<!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>
2 Answers
shay elbaz
2,885 Pointsfunction returnValue(arg){ return arg; }
Luke Pettway
16,593 PointsI think the problem is that after your function declaration you are creating a variable and then returning immediately after. The syntax here wouldn't work.
The second step in the challenge wants you to assign a value to a variable by calling the function with an argument.
The first part of this is right:
function returnValue(value)
{
return value;
}
The second part immediately after should look like this:
var echo = returnValue('myString');
What the above is doing is creating the variable echo
and then assigning it to the value returned by the function you created called returnValue
. That function takes in one argument which is expected to be a string (not explicitly but because the challenge expects it to be a string). The string that you specify as the argument is then returned by the function and assigned to the variable you declared earlier.
Moosa Bonomali
6,297 PointsMoosa Bonomali
6,297 PointsYour function declaration was sufficient for the challenge. Which is to create a function that returns the values passed into it;
Did you intend to do something other than that?