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

James Hallett
James Hallett
6,605 Points

passing function to arguements

Just not getting it... I thought I had it but the wording of this quiz is weird!

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

2 Answers

Antonio De Rose
Antonio De Rose
20,885 Points
function returnValue ( wtf ) {
  var echo = (); //you have to assign this variable, outside this scope to make use of the variable, this will be the resulting variables value, when the function is been called.
  return wtf; 
}

//by the way, when you call the function, just do not put only parenthesis,
//you are calling a named function should be like

// var echo = returnValue('hello');
James Hallett
James Hallett
6,605 Points

Ya thanks man! I got it eventually. I m just super tired and the fact that the example was named "returnValue" just kept messing with me! Got it now thanks :)