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 trialDonald Beaudin
4,461 PointsHelp me with this i don't know what it is asking.
help
function returnValue(echo) {
var message = "hello"
return message;
}
<!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
Cena Mayo
55,236 PointsHi Donald,
The first part of this challenge simply wants you to create a function that returns whatever is input as an argument, like so:
function returnValue(myArgument) {
return myArgument;
}
The second part says: " After your newly created returnValue function, create a new variable named echo. Set the value of echo to be the results from calling the returnValue function. When you call the returnValue function, make sure to pass in any string you'd like for the parameter. "
so, we want to create a new variable called echo that is assigned to the returnValue function. The function has a string passed to it as an argument:
var echo = returnValue("Hello");
The end result of this is that the variable echo now contains the return value of the returnValue function, which in this case is the string 'Hello'. Does that help?
Best, Cena
Jacob Mishkin
23,118 PointsYou are very close, you just need to remove the var inside the function: Your answer is correct, but the questions wants something very simple like this:
function returnValue(a){
return a;
}
Matthew Rigdon
8,223 PointsIt took me a few minutes to understand what the question was asking as well. The question wants you to create the returnValue function that takes in a string:
function returnValue(arg) {
return arg;
}
The second part of the question is what was confusing for me. You have to create a new variable echo and set that equal to the function you are calling:
var echo = returnFunction("Hello!");
Donald Beaudin
4,461 PointsDonald Beaudin
4,461 Pointsthank you so much!!!!!
M W
3,446 PointsM W
3,446 Pointsnicely explained - thanks