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

M Robering
M Robering
9,192 Points

Storing returned value inside variable

It seemed pretty straightforward but apparently I've made a mistake somewhere. At this point I have no clue what exactly I'm doing wrong. I've tried to put the variable inside the function but that doesn't work either. It keeps saying that it doesn't look like I'm storing the returned value in the echo variable.

Mike Rogers
Mike Rogers
5,280 Points

Can you post your code?

2 Answers

Jeff Wilton
Jeff Wilton
16,646 Points

You are just supposed to assign the value of echo to the value returned by the function. It should look something like this:

function returnValue(anything) {
  return anything;
}

var echo = returnValue("Hey!");
M Robering
M Robering
9,192 Points

It worked, thanks! :)