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 trialaliceinwonderland
7,679 Pointsi don't understand what i'm doing wrong. please help!
thank you.
function returnValue(minutes) {
return minutes;
}
var echo = minutes;
returnValue("60");
<!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>
3 Answers
Tabatha Trahan
21,422 PointsYour function is correct. The issue is with setting the variable echo equal to the return value of the function. To do that, you just need to declare the variable, and then set it equal to the value of the function with a string passed to it:
var echo = returnValue("some string");
This way, you are assigning the result of the function to the variable echo. I hope this helps.
Erwan EL
7,669 PointsHi, problem is that you assigned to the variable echo, minutes that is a argument of the function returnValue. If you want to do that, the echo variable needs to be inside the function because minutes is not defined out of the function. You can simply to that:
function returnValue(minutes) {
return minutes;
}
returnValue("60");
Or if you really want your echo variable inside:
function returnValue(minutes) {
var echo = minutes;
return echo;
}
returnValue("60");
aliceinwonderland
7,679 Pointsthank you so much. i appreciate your help!
aliceinwonderland
7,679 Pointsaliceinwonderland
7,679 Pointsi appreciate your help, tabatha. thank you!