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 trialkingdavid igbayilola
8,678 Pointsfunction
i am trying to allow the variable to store a information but i keep getting the error message
function returnValue(jupiter) {
var echo = jupiter;
return echo;
}
returnValue("jupiter");
<!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
kingdavid igbayilola
8,678 PointsThanks what about the ( ; ) is it not supposed to be there
Cooper Runstein
11,850 PointsYou're trying to do too much in the function, you need to set the variable echo to equal the result of the returnValue function when passed a string of your choosing.
function returnValue(arg){
return arg
}
var echo = returnValue("string")
Cooper Runstein
11,850 PointsCooper Runstein
11,850 PointsYes, sorry, it's really good practice to end your lines with semi-colons, in this particular case you actually don't need to, but I typed that out fast and forgot to add them in. It's definitely best practice to have that semi-colon: