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 trial

JavaScript JavaScript Basics (Retired) Creating Reusable Code with Functions Passing an Argument to a Function

Ferdinand Fabian
Ferdinand Fabian
3,909 Points

i just dont understand the task. its just not working as described in the video

please just give me a hint to the solution beacuse i dont see any solution hints in de the video

script.js
function returnValue(anything){
  var echo;


  return anything;
}

returnValue("hello");
index.html
<!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

Damien Watson
Damien Watson
27,419 Points

Hi,

You were pretty close, the wording is a bit tricky, it says to create a variable 'echo' but it is not to be inside the function, it is to equal the return value from the function, so place it outside and make equal to the function call:

function returnValue(anything){
  return anything;
}

var echo = returnValue("hello");
Ferdinand Fabian
Ferdinand Fabian
3,909 Points

thank you very much :) makes sense! but i couldn t find any explanation to that in the video ....anyway :) thanks alot

Damien Watson
Damien Watson
27,419 Points

No probs :) Yeh, sometimes the wording is hard to understand.