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

Mitchell Wheeler
Mitchell Wheeler
1,027 Points

Im just completely lost on this problem, the vocab is hard for me to grasp, and what they are trying to tell me to do.

ive watched the video over again, but what they are asking me to do in the second part, it just to confusing to wrap my head around

script.js
function returnValue(water, bottle) {
  var holder = water + bottle
  return holder;

var echo = returnValue(water, bottle);
return holder;
}
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,236 Points

It looks like you did a bit too much. Task 1 asks you to "Create a function named returnValue that accepts a single argument, then immediately returns that argument.". But the one shown here takes two arguments and combines them.

Then for task 2, you'll call the function and put the result into "echo", but you'll pass in a single string as the argument. You'll only need one line for this part.