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

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,633 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! :)