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 trialAlan Jaffery
4,803 PointsChallenge - Java Script Basics: Create a function
The Task is: Create a function named returnValue that accepts a single argument (you can name it anything), then immediately returns that argument.
I dont know what i did wrong? Can someone help!?
Thank you and kind regards, Alan
function returnValue(test){
return returnValue(test);
}
<!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
Romain Gaget
24,449 PointsYou are passing the argument test that you need to return: then if you call the function returnValue('hello') that will return hello
function returnValue(test){ return test; }
Alan Jaffery
4,803 PointsSo i dont return the function, i just return the argument?
Thank you for helping :)
Antonio De Rose
20,885 PointsAntonio De Rose
20,885 PointsI suggest you go through the video again and get an idea, function creation is correct, acceptance of the parameter is correct, the way you return is wrong.