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 trialCharles Ng
4,444 PointsI am not sure I understand their instructions
I am stuck. please help.
function returnValue(abc) {
var echo = abc;
return abc;
}
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>
3 Answers
Steven Parker
231,236 PointsThe assignment of the new variable "echo" should occur after the function, not inside it.
Leave the function as it was when you passed task 1.
But if that hint is not enough, you should end up with something like this:
SPOILER ALERT
function returnValue(abc) {
return abc;
}
var echo = returnValue("Hello");
Cindy Lea
Courses Plus Student 6,497 PointsThe thing to remember for challenges is only give them what they ask for. Dont put in any extra lines of code, it is a computer that checks the answers. That being said, they just want you to create a function with one parameter that returns the value that was passed to it:
function returnValue (abc) { return abc; }
This passed the challenge.
Charles Ng
4,444 PointsThanks anyway.
Jesus Mendoza
23,289 PointsWhen a function returns something, you can store that something in a variable.
var echo = returnValue(abc); will store abc inside the variable echo
Charles Ng
4,444 PointsI did that and it said "Oops! It looks like Task 1 is no longer passing." That's why moved the "var echo" back inside the function.
Charles Ng
4,444 PointsThank you.
Charles Ng
4,444 PointsCharles Ng
4,444 PointsThanks man! I was so frustrated.