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 trialRamone Adams
Front End Web Development Techdegree Student 8,693 PointsNot sure if it's a bug but it's telling me that I'm not storing my return value into my variable which I'm sure I am
Is this not the correct way to input my variable into my function?
function returnValue(mama) {
var echo = "mama"
return mama
}
console.log( returnValue("mama") );
<!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
Tobias Helmrich
31,603 PointsHey Ramone,
you're storing the string "mama" inside the variable echo (not the argument mama, if you would like to use the argument you shouldn't write it in quotes). However you should store the return value of the function in the variable echo after the function.
Like that:
function returnValue(arg) {
return arg;
}
var echo = returnValue("Hello");
I hope that helps, if you have any other questions feel free to ask! :)
Ramone Adams
Front End Web Development Techdegree Student 8,693 PointsRamone Adams
Front End Web Development Techdegree Student 8,693 PointsThank you Tobias that makes a lot of sense. This helped greatly.