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 trialSamuel Igborgbor
4,335 PointsPassing an argument to a function
After the code below i keep getting the response 'It looks like task 1 is no longer passing'
function returnValue(greeting) { var echo = greeting return greeting } returnValue(Hello)
function returnValue(greeting) {
var echo = greeting
return greeting
}
returnValue(Hell0)
<!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
Florian Stegemann
Full Stack JavaScript Techdegree Student 22,660 PointsAccording to the exercise the echo variable should be created outside of the function and it should be assigned the return value of a call of the returnValue function with a String argument:
function returnValue(arg) {
return arg;
}
var echo = returnValue("Hallo");
Paul Walker
28,904 PointsHey Samuel,
Now this function will not display to anything, but that's how I would write it out. Hope that helps.
function returnValue ( greeting ) { return greeting; } returnValue("Hello");