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

Modify the returnValue function to accept one argument named value.

I don't understand what is wrong with my code; this has been troubling me for 2 hours!!

function returnValue(Value) { return Value; }

var echo = returnValue("Value");

script.js
function returnValue(Value) {
  return Value;
}

var  = returnValue("Value");
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>

function returnValue(value) { }

1 Answer

Steven Parker
Steven Parker
231,275 Points

I see two different versions of the code here, the one that was entered into the challenge is missing the variable name "echo".

But the version you put in by hand is has that part correct! The only other issue is that the challenge wants you to use an argument name of "value" (with lower-case "v") but this code shows "Value" (with a capital "V").

I did and i keep getting the error "The function declaration doesn't have an argument named 'value'"

so would the code be function returnValue(Value) { return Value; }

var echo = returnValue("value");

all i would have to do is have a lower case ("V")? because even that doesn't work.

the error I'm getting is "The function declaration doesn't have an argument named 'value'"

Steven Parker
Steven Parker
231,275 Points

I would expect that exact error if you still have capital "V" instead of little "v".