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

I cannot solve this one.May I ask for your help? I'm clearly missing something, even the console can't help me.

I'm passing task one, but on the second task I'm getting stuck by the returning value. Something about the return thing I can't understand.

script.js
function returnValue(meta) {
  return meta;
  var echo = function returnValue()
  }
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

Matthew Long
Matthew Long
28,407 Points

You've almost got it. It looks like you're trying to call the function inside itself? You need to move the echo variable outside of the returnValue function. Also, you don't need the function keyword when calling a function. Lastly, don't forget to add a parameter inside your returnValue function call as well as a semicolon.

function returnValue(meta) {
  return meta;
}

var echo = returnValue("I'm a string!");

Thanks mate!