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

I have been stuck on this task; I'd love the correct code so I can make sense out of what I am doing wrong.

The way this task is phrased, for some reason, is killing me.

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


returnValue('hi') ;
var echo = saySomething;
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

This is all you need to complete this challenge. You do not need to call the function. Also, your last line of code is invalid.

function returnValue (saySomething) {
  return saySomething;
}

You need to call the function for task 2.

Thanks. When I took the challenge, I only created the function and the check accepted my input.

Ah, I think i figured this out.

function returnValue(saySomething) { return saySomething; }

var echo = returnValue('hi') ;

changed from comment to answer