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 trialJabor Al thani
2,926 PointsIm stuck on this exercise
I need help with the " How to store the returned results of the function back to the variable ?
function returnValue (str) {
var echo = str;
return echo;
}
returnValue('hello');
<!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
Steven Parker
231,236 PointsDon't let the language throw you off.
The phrase "store the returned results...back to the variable" just means "make an assignment". So you will create the variable and assign it at the same time using the assignment operator (equal sign: "="), like this:
var echo = returnValue('hello');
Also, while your function is working as-is, you can simplify it by removing the internal variable and just returning the argument directly:
function returnValue(str) {
return str;
}
Jabor Al thani
2,926 PointsThanks for the reply Steve , Its still a little cobfusing for me as its not going through the next stage .
Could you please put the full syntax