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!

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

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

function returnValue(Panda){
  return Panda;
  var echo = "+" (returnValue);
 get returnValue;
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

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 :)