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 trialCraig Watson
27,930 PointsTask 2, Storing the results of my function in a variable?
Hi everyone,
I followed allon with the vid but am struggling to get to grips with task 2 of this challenge,
Storing the results of my function in a variable and passing it the argument "My argument" .... :S
Hop you can help :)
Craig
<!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>
2 Answers
Gergő Bogdán
6,664 PointsThe solution is very easy, you just specify an argument for your function and return that variable:
function returnValue(argument) {
return argument;
}
var echo = returnValue('My argument');
geoffrey
28,736 PointsHey Grego, your solution is correct, would you mind posting it as answer instead of comment ? This way we can mark your intervention as best answer ;)