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 really can't figure this out, can someone help?

i'm really not sure where the string comes into play. help please.

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

Steven Parker
Steven Parker
229,732 Points

The instructions say to pass a string argument, but here a number (30) is being passed in instead.

But It also looks like you got a little off-track. The function you created in task 1 should remain as it is when you do task 2. All of the instructions related to the "echo" variable should be performed outside of the function.

And you won't need "console.log" for this challenge.