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

Thomas Cormier
Thomas Cormier
2,496 Points


I am stuck on the second part of this quiz. I have no idea what I am doing wrong and the quiz hints do not help at all. It also keeps "timing out" every time I submit my answer. I have to copy past my code:

function returnValue (breakfast) { var echo = (breakfast); return breakfast; } returnValue ('eggs');

Tushar Singh
Tushar Singh
Courses Plus Student 8,692 Points

First You have to create a function that returns the value that you pass in the function(argument) and then store it in a variable called "echo".

function returnValue(arg) {
  return arg
var echo = returnValue("Hello");

2 Answers

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Echo is a variable to be declared outside the function. The value of echo will be the string you pass to the function.

Take a look at my example:

function returnValue(myValue) {
  return myValue;

var echo = returnValue("This works!  YAY!");

We initialize a variable echo outside of the function by calling the function and then sending it a string. That string is now assigned to the variable echo.

When your challenge times out, click on the X to close the window. Don't click either of the two buttons offered. Then run check work again.