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

Christopher Leveston
Christopher Leveston
2,987 Points

Not quite sure the question they're asking. Stuck on adding the string.

I'm not sure if I am getting what the question is asking for. I was able to display the value that I want in the function's parameters by calling it, but I am kinda confused on adding the string part. Here is what I got.

function returnValue(number,string) {
  return number;
  return string;
var echo = returnValue(10, "the string");
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

1 Answer

Pro Student 50,936 Points

I'm surprised the first task passes. According to the instructions you are to have a single parameter. Remove all code related to number and the document.write statement and you should pass.

Christopher Leveston
Christopher Leveston
2,987 Points

Oh wow! Thanks a bunch. During the first task, I assigned just one parameter to the function, but when I got to the next task, that's when I added all that extra nonsense LOL. While I was waiting on a response, it clicked that adding a second return wouldn't work because the program will only see the first return and not the 'return string', so I knew that was wrong. Thanks for the response!