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 trialRyan Amansec
1,962 PointsSet the value of echo to be the results from calling the returnValue function
I'm stuck trying to set the results of returnValue to the variable "echo"
function returnValue(name) { var echo = name; return echo; }
returnValue("Rayray")
function returnValue(name) {
var echo = name;
return echo;
}
returnValue("Ryan");
<!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
james south
Front End Web Development Techdegree Graduate 33,271 Pointsecho doesn't go in the function, it goes after and outside it. your function can just return the parameter 'name', you don't have to put that in another variable just to return it. then just point your call of the function to your variable and it will store the return value of the function.
Ryan Amansec
1,962 PointsCool. Thanks!
John Lukacs
26,806 Pointsfunction returnValue(str){ return str; } var echo = returnValue("hype");