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

Marwan Solh
Marwan Solh
2,057 Points

Task 2 of of Passing in argument in a function task

I keep getting "Oops! It looks like Task 1 is no longer passing." for Task Two. I can't figure out what I did wrong. Here is the code:

function returnValue(fox) {
  return fox;
}

var echo returnValue("dragon");
script.js
function returnValue(fox) {
  return fox;
}

var echo returnValue("dragon");
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>

2 Answers

Andreas Nyström
Andreas Nyström
8,887 Points

Hi!

You forgot one small little thing. Other than that everything looks fine. So:

var echo returnValue("dragon");

Should be:

var echo = returnValue("dragon");

So what happened was that you just forgot an equal sign. Hope this helps. :)

Marwan Solh
Marwan Solh
2,057 Points

ahhh, silly me. Thank you very much!

Andreas Nyström
Andreas Nyström
8,887 Points

Not silly at all! Happens to everyone every day :)!

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing fantastic! Would it be comforting to know that you're off by literally one character? The challenge is asking you to assign the result of running that function to the variable echo. You set up var echo and then you called the function, but you forgot the assignment. Remember, we use the equals sign = to do an assignment. In your last line, there should be an equals sign, but I'll leave the placement up to you.

:bulb: The reason you're receiving the "Task 1 is no longer passing" is because the omission of the equals sign is causing a syntax error and your code can no longer be interpreted.

Hope this helps! :sparkles:

Marwan Solh
Marwan Solh
2,057 Points

Thank you very much :) I can't believe I missed that