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

Jason Styron
PLUS
Jason Styron
Courses Plus Student 955 Points

I do not understand this challenge, I have tried it multiple times and for some reason task 2 is not clicking with me.

function returnValue(time){ var echo = ( time + 'minutes to my house'); return time }

???

script.js
function returnValue(tripmileage){
  var echo = returnValue;
  return tripmileage
}
returnValue('20 + 30');
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

Ryan Navarro
Ryan Navarro
13,889 Points

The challenge is having you assign the variable the function with the parameters var echo = returnValue("20+30");

Just to piggyback off this. The challenge is requiring you to assign the variable after the function. Not inside the function.