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

Jared Bilton
PLUS
Jared Bilton
Courses Plus Student 2,061 Points

I can't figure out how to answer this correctly. I have reviewed the video and don't understand how to call best result

Haven't lots of issues with this one. Are we to include the variable within the code block from task 1?

script.js
function returnValue(drink) {
  return drink;
}
var echo = return drink;
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

This is the correct code for both steps of the challenge <blockquotes>

function returnValue (name) {
  return name;
}
var echo = returnValue("Lakindu Jayathilaka");

</blockquotes> The second step tell us to set the value of echo to be the results from calling the returnValue function. so we must call the 'returnValue' function like this 'returnValue("Lakindu Jayathilaka")' Please mark my answer as the best if i helped u...thanks