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 trialJose Gonzalez
5,032 PointsWhat is wrong with my Code?
** Here is the error I am getting **
Bummer! Hmmm. It doesn't look like you're storing the returned value in the echo
variable.
function returnValue( arg1 ) {
var echo = arg1;
return arg1;
}
returnValue('My argument');
<!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
Rich Donnellan
Treehouse Moderator 27,696 PointsJose,
You weren't supposed to alter the function in the second challenge question. This question only asks you to store the function's return value in a variable named echo
. You can do so like this:
var example = someFunction(parameter);
Hopefully this will help you without giving you the answer.
βRich
Jose Gonzalez
5,032 PointsThanks for the reply Rich. I swear I tried that first, and then a million other variants. I still cannot get it to work. here is what I have now: function returnValue(par1) { return par1; var echo = returnValue('My argument'); }
I have not had a problem so far with this course at all, but for some reason, I'm just not seeing the problem. Any more suggestions?
Jose Gonzalez
5,032 PointsJust got it working. The var needs to be outside the curly braces.
Thanks again, Rich. You are a Rock star!
Rich Donnellan
Treehouse Moderator 27,696 PointsYou are! Keep at it brotha!