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

do not understand what this task whats from me!

what is this task ask me to do!? Confusing

script.js
function returnValue(number){
    var echo = number; 
  return "" + echo;
}
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>

1 Answer

Hi Farhan,

for the first part of the challenge you are just asked to create the function with any paramenter (which you did correctly) and return the value of the parameter inside the function. For that you actually do not need the "" + that you wrote. You can just write: return number;

In the second stage you are then asked to declare a variable called echo and assign the function to it (not the parameter name). Like this:

var echo = functionName(argument);

But you have declare the variable OUTSIDE (under) the function - not inside as you did.

And the argument you pass has to be a string.

Does that help?

Let me know if you need any further assistance!

Happy coding!

Nils

PS: You can upvote my post and/or mark as "best answer" (at the bottom of my post) if it helped you. :-)