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

Aaron Jones
Aaron Jones
637 Points

Im stuck here

The question asks

After your newly created returnValue function, creat a new variable named echo, Set the value of school to be the results from calling the returnValue function. when you call the returnValue function, make sure to pass in any string you'd like for the parameter.

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

Ryan Dudley
Ryan Dudley
Treehouse Project Reviewer

Hey, hope your day is going well so far!

While what you have entered is completely valid JavaScript, and would work just fine; it is not what the question wants you to do. Also it may be worth noting for future reference, in the code you supplied you are creating the echo variable within the function and storing the parameters value in it, but returning the parameter value anyways and not using the echo variable; which makes the echo variable unnecessary.

Anyways, in this code question I believe it wants you to create a new variable named echo outside of the function you created, and then use the function to store the value it returns into echo.

So using your function as an example, it would look like this:

function returnValue(bmw) {
  return bmw;
}

var echo = returnValue('bmw'); // This will store the string 'bmw' into our echo variable.

Hope this was able to solve your issue!