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 trialJesus Marco del Carmen
10,393 PointsHow to create the variable in step 2?
I can't seem to do the 2nd step. How do I create the variable then return the value?
The name of my parameter is color this is my code for the 1st step /* function returnVariable(color) { return color; }
returnValue("Red"); */
I don't know how to insert step 2 into this code. Where do I place the variable and how do I immediately return the value?
<!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
Jason Anders
Treehouse Moderator 145,860 PointsHey There,
Your code is essentially correct, except I'm not sure how you passed the first part of the challenge, as your function is not named correctly (according to the instructions). ??
Aside from that, the code you need for the second part is correct, with one exception... you need to assign the return value to a variable named echo
.
function returnValue(color) {
return color;
}
var echo = returnValue("Blue");
Jesus Marco del Carmen
10,393 PointsJesus Marco del Carmen
10,393 PointsThank you very much! I've been stuck at this since yesterday :) The concept of storing return values is still kinda frustrating to me. I guess I just need to review the videos.
Thank you again, Sir Jason!