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

Matthew Ashman
Matthew Ashman
4,364 Points

Functions: passing and returning arguments

Just looking for some assistance and explanation as I am not understanding where the error is happening.

function returnValue('dick') {
  return dick;
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>
Matthew Ashman
Matthew Ashman
4,364 Points

Here is the question/objective:

"Create a function named returnValue that accepts a single argument (you can name it anything), then immediately returns that argument"

1 Answer

Steven Parker
Steven Parker
229,967 Points

You quoted the name of your argument on the top line. Drop the quotes.

Later, you could call this function passing in a literal string, but you can't define it that way.

Matthew Ashman
Matthew Ashman
4,364 Points

Thanks Steven,

I ended up fiddling around with what I had, and figured it out by problem solving. Still pretty new to HTML/CSS/JS so I'm not entirely sure what you meant in your second line of explanation.

If you'd care to help me figure out this additional challenge.. I'd appreciate that as well.