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 PointsI've misplaced it?
I'm missing something?
function returnValue(echo)
{
return value (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>
3 Answers
Moosa Bonomali
6,297 PointsTry this to return the value passed into the function;
function returnValue(echo)
{
return echo;
}
Kim Dallas
11,461 Pointsthat works except it says the var is not called
Adam Beer
11,314 PointsAfter the return delete the value and the brackets. And now when you call the function inside a variable and pass it to the value, your value will be returned.
Myles Young
Full Stack JavaScript Techdegree Graduate 22,056 PointsSo the reason you would want to return (echo) is bc in the function you created the main value you want to return is the parameter that you passed in your function (echo). Now if you return value(echo) you can get an error bc value would be undefined. Another thing you could do is declare βvalueβ as a variable, and then set its value to your parameter (echo). Then your original answer would be valid also
Moosa Bonomali
6,297 PointsMoosa Bonomali
6,297 PointsIt should be like this;