JavaScript JavaScript Basics 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

Nils Kriedner
Nils Kriedner
Front End Web Development Techdegree Student 19,062 Points

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. :-)