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

adele wilson
PLUS
adele wilson
Courses Plus Student 4,058 Points

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

Tim Acker
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Tim Acker
Front End Web Development Techdegree Graduate 31,247 Points

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.

adele wilson
PLUS
adele wilson
Courses Plus Student 4,058 Points

Ah, I think i figured this out.

function returnValue(saySomething) { return saySomething; }

var echo = returnValue('hi') ;

changed from comment to answer