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

Tarzine Jackson
Tarzine Jackson
1,023 Points

I am not sure what is wrong, I declared the variable to return the results from the func and I keep getting an error.

function returnValue(str) {//new created function from (task 1) var echo = 'hello';//newly variable named with the results from calling the returnValue function return str; //return argument (task 1) } returnValue('hello');//call the function

1 Answer

function returnValue(val) {
  return val; // Return the value

// Call the returnValue function passing "Treehouse" as an argument
// And store the result (return value) in the echo variable
var echo = returnValue("Treehouse");
Pauline Hilborn
Pauline Hilborn
3,879 Points

Thank you, Rafael! I got stumped on this also. I got really confused on the terminology, but it all makes sense now. THANK YOU!!!