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 Giving Information to Functions

Walter Cortez
Walter Cortez
4,071 Points

need help with task 2

function returnValue(drink) { var echo = drink return echo;
}

returnValue(coffee);

-What is wrong here? I tried snapshot but for help but didnt want to work for me.

-Thanks

Walter Cortez
Walter Cortez
4,071 Points

...sorry I mean task 2 of 2.

1 Answer

Michael German
seal-mask
.a{fill-rule:evenodd;}techdegree
Michael German
Full Stack JavaScript Techdegree Student 2,017 Points

I was literally just stuck on this same task. I also was trying to declare the var echo inside the curly braces {}. However the code runs correctly like this.

function returnValue(drink) { 
    return drink;
}
var echo = returnValue("coffee");
Walter Cortez
Walter Cortez
4,071 Points

Thank you Michael will try this!