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

James Reynolds
James Reynolds
3,182 Points

I'm on task 2 but when I check my work it keeps telling me that task 1 is no longer passing. When I go back task 1 works

I can't tell if my code is wrong or if there is a bug. If my code in task 2 is wrong then why does it keep saying "Oops! It looks like task 1 is no longer passing"?

script.js
function returnValue(echo) {
  var echo = returnValue();
  return echo;
}
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,072 Points

The message may be confusing, but if you introduce a syntax error it invalidates the entire script, and since it re-tests the tasks in order it will cause that message.

The task 1 function should just return the argument. And in task 2, all additional work is done after the function (not inside it). The code above looks like the two tasks got mixed up.