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

Christopher Gjelten
Christopher Gjelten
2,305 Points

too stupid

help

script.js
function returnValue(test) {

  return test;

}
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>
Emmanuel C
Emmanuel C
10,636 Points

Whats the problem? What error message is it giving you?

1 Answer

Don't get down on yourself over this. You are not stupid, it just takes some time to learn. After creating the returnValue() function, (which you have already done perfectly) it asks you to do a few things.

// create a new variable named echo
// Set the value of echo to be the result from calling your returnValue function 
// and pass in any string for the parameter
var echo = returnValue('any string you like goes in here');

check out https://teamtreehouse.com/library/giving-information-to-functions as a refresher if needed and don't give up :D

Christopher Gjelten
Christopher Gjelten
2,305 Points

Thanks, figured out now!! Its weird tho, it was very easy lol