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

Every time I push the submit button my work will not go through and it takes me back to the beginning of this section.

Can this be fix for I can continue with this lesson

script.js
function returnValue(spike) {
  var echo = returnValue();
  return spike;
}
returnValue("Cowboy bebop");
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

1 Answer

Steven Parker
Steven Parker
231,269 Points

Inside your function, you assign the variable echo by having the function call itself. This creates an infinite recursion (like an infinite loop, but worse) and breaks the challenge elevator.

For task 2 of the challenge, you will assign the variable echo after the function, by calling the function with your choice of argument. Leave the function itself just as it was when you passed task 1.