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

Jennifer Riess
Jennifer Riess
8,726 Points

Need help on this one. Not sure if it's my logic or if I'm not understanding the prompt.

Thanks!

script.js
function returnValue(argument) {
  var echo = returnValue(argument);
  return = echo;
}

returnValue('12');
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

Cooper Runstein
Cooper Runstein
11,850 Points

The challenge is asking for you to create a function that accepts one string, which you have, and then returns that string. The echo variable should then be set to the 'returnValue' function with a string passed to it. Right now you have echo set inside the function, the challenge though worded strangely, wants you to declare echo after you create the function. Also make sure to pass 'returnValue' a valid string when declaring echo. Also you don't need the '=' after return.