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 trialLucas Huerta-Murillo Grau
Courses Plus Student 1,365 Pointswhat's wrong here?
...
function returnValue( gol ) {
return gol
}
var echo = returnValue();
returnValue( "GOLAZO" );
<!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
nico dev
20,364 PointsHi Lucas Huerta-Murillo Grau ,
You're following very well all the instructions for the challenge linked to in the top-right of this screen. Good work! And, by the way, that's a cool football-related metaphor, too! :)
Now, I only see two possible problems making it difficult for you to pass the challenge:
I know it's not always strictly necessary, but maybe the lack of the semicolon at the end of your
return
statement could be giving you trouble.The one more likely is the fact that the challenge is asking you to pass the argument to the function within the variable declaration (i.e.: not in a separate statement, but at the same time you declare the
echo
variable).
I hope that helps clarify it enough to you, but otherwise feel free to follow up!
SRIMUGAN J
Courses Plus Student 5,345 PointsCan you Please Elaborate your question here...???
If you are using return, the function stops the execution and return the value in echo, but you didn't pass any arguments in the first call, hence the first call return undefined and again you passed the argument "Golazo" , it will return as Golazo.
If this wasn't your expected answer please ask in detail...
Hope this helps :)
Tommy Leng
Front End Web Development Techdegree Student 12,417 Pointsfunction returnValue( gol ) { return gol }
var echo = returnValue('ANY STRING');
You are only storing the 'string' in the variable echo. You don't have to call the function;