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

Fabrice Innocent
Fabrice Innocent
Full Stack JavaScript Techdegree Student 9,715 Points

So for the second part of this challenge..I can't seem to grasp what it is I'm missing/doing wrong Any help?

I'm not understanding why i'm getting this particular error message

function returnValue(lit) {
    var value = lit;
  return value;

function returnValue(peace) {
    var echo = returnValue(peace);
  return echo;

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

1 Answer

Nils Kriedner
Nils Kriedner
22,768 Points

Hi Fabrice,

for the first part of the code challenge you can make the code easier: You don't need to create a variable and reassign the parameter/argument to the variable. You can just return the the argument like this:

function returnValue(number) {
  return number;

In the second part of the challenge you then need to create a variable named echo (OUTSIDE of the function) and assign the value with the function. For the function parameter you can pass any number or string.

Makes sense?

Try a bit and if you still need help feel free to ask again!

Happy coding,


PS: You can upvote my post and/or mark as "best answer" (at the bottom of my post) if it helped you. :-)