Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Kevin Jervis
Kevin Jervis
2,600 Points

Arguments and Functions

Hi Guys

Just got this message: It looks like Task 1 is no longer passing.

Thanks Kevin

script.js
function returnValue(Panda){
  return Panda;
  var echo = "+" (returnValue);
 get 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>

2 Answers

Hi there,

This is happening because the second step wants you to add the code after the function, rather than inside of it. Task 1 is no longer passing because it's looking for a function that just returns the value and nothing else.

What you're trying to do is just declare a variable, echo, and set it equal to what you get when you call your returnValue function. It would look something like this:

function returnValue(Panda){
  return Panda;
}

var echo = returnValue("Pandas are awesome");

Here, when echo is initialized it will run the returnValue function and pass in the string "Pandas are awesome". That string gets saved to Panda when the function runs, and then returned on the "return Panda" line.

Kevin Jervis
Kevin Jervis
2,600 Points

Hi Katie

I see now That makes sense. Thank you for the clear and concise explanation :o)

No problem! Glad it helped :)