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

Max Gabriel
Max Gabriel
8,859 Points

I'm confused as to which is the argument and the parameter.

.

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

joelearner
joelearner
36,591 Points

Hi Max,

You are very close. You really just need to separate the variable from the function to complete the challenge. Try placing the var echo outside of returnValue function and you are basically there. Then, simplify your code to return the string echo and you are done. Your code should look something like this:

function returnValue(echo) {
  return echo;
}

var echo = returnValue('echo');

Cheers!