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 trialMatthew Ashman
4,364 PointsFunctions: 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;
}
<!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
231,236 PointsYou 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
4,364 PointsThanks 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.
Matthew Ashman
4,364 PointsMatthew Ashman
4,364 PointsHere is the question/objective:
"Create a function named returnValue that accepts a single argument (you can name it anything), then immediately returns that argument"