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 trialLynnette Jones
2,543 PointsNeed help with this task
I don't understand this part of the challenge. I have tried this many ways with no success. Anyone have any pointers?
function returnValue(width) {
return width;
}
<!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
Gianmarco Mazzoran
22,076 PointsHi,
the challenge is asking you to store your new function inside a variable named echo. And then pass a string as value of the function.
Here's what you need:
function returnValue(arg) {
return arg;
}
var echo = returnValue("your string");
Carlos Federico Puebla Larregle
21,074 PointsLike the task says "This isn't that useful of a function" it's just for you to understand how you can pass an argument to a function. In the next step of the task it asks you to assign the returned value from the function to a newly created variable called "echo". Like this:
function returnValue(width) {
return width;
}
var echo = returnValue("Anything");
I hope that helps you a little bit.
Lynnette Jones
2,543 PointsLynnette Jones
2,543 PointsThank you so much. I was making this much more difficult than it needed to be.