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

johnny louifils
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
johnny louifils
Full Stack JavaScript Techdegree Graduate 18,926 Points

I'm getting n piss what am i suppose to do

everytime i do this it keep saying the same time and i just driving mad alittle

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

Hey johnny louifils ,

You are so close with your answer and I can see why you might be frustrated. the instructions aren't entirely clear on WHERE you should place the variable.

What you'll want to do is move your variable in front of your call to returnValue('str').

So it should look something like this.

var echo = returnValue('str');

I hope this helps you.