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

1 Answer

Steven Parker
Steven Parker
176,584 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
176,584 Points

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