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

Seth Warner
Seth Warner
5,348 Points

What is wrong with my code?

It is asking to make a function named "returnValue" and give it one argument. Have the function return its self.

What do I have wrong?

Seth

script.js
function returnValue(egg) {
  return returnValue;
}

returnValue(3);
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

Hi Seth,

It wants you to return the argument that was passed in.

In your case, you want to return egg

Also, you don't need to call your function yet for task 1. You only need to write the function.

Peter Smith
Peter Smith
12,347 Points
function returnValue(egg) {  
  return egg;  
}  

returnValue(3);