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

Call a function with return value

Hi!

I can't seem to solve this problem - tried it many different ways! Please help! :)

/E

script.js
function returnValue( holler ) {
  return holler;
      var echo = return;


}
returnValue('Hello' + echo);
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

You had the first part right. The next part of the challenge wants you to make a new variable, and assign its value to the call of that function. Passing in string to the function. Something like this.

function returnValue( holler ) {
  return holler;
}

var echo = returnValue("Example");

It's nice to see you here Daniel Languiller . That's a nice explanation :) Hey Emma Back , if you got you answer , must mark this genius guy's answer as "Best Answer" .

THANK YOU! Helped a lot :) Absolutely gonna mark it as best answer Aakash Srivastav

Thanks , All the best . Keep coding :)