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 trialJairo Montenegro
3,687 PointsWhat am I doing wrong?
?
function returnValue(color) {
var echo = color;
return echo;
}
returnValue('My arguement');
<!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
Ryan Ruscett
23,309 PointsHey,
Your code (below) - Calls a function that takes a color. Ok that' good. You just need to return the color in the function. There is no need to do var echo = color; and return echo. Just return color (As shown in my code below your code). Then you need to call the function. BUT remember the function returns a value. So you call the function, but you don't store the returned varaible or color into anything. We need to save the returned value from calling the function into var echo. As shown in my code blow you code.
function returnValue(color) {
var echo = color;
return echo;
}
returnValue('My arguement');
MY CODE
function returnValue(color) {
return color
}
var echo = returnValue("My argument")
You may have overthought this which I do all the time. Let me know if this clears it up for you or if you have other questions or issues you would like cleared up.
Thanks!
Dale Bailey
20,269 PointsA couple of things its asking you put the function into the variable echo and pass it a string of 'my argument' (which is misspelt btw). Like this
function returnValue(color) {
return color;
}
var echo = returnValue('My argument');
Jairo Montenegro
3,687 Pointsahh thanks man
Jairo Montenegro
3,687 PointsJairo Montenegro
3,687 Pointsthanks broski