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 trialBrian Johnson
Front End Web Development Techdegree Graduate 20,818 PointsI've been stumped on this for hours! Please tell me what i did wrong. Thanks
I appreciate the assistance
function returnValue(length){
var echo = length;
return length;
}
returnValue('50');
<!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>
4 Answers
David Evans
10,490 PointsHi Brian,
You are so close! Try re-reading the question.
After your newly created returnValue function, create a new variable named echo. Set the value of echo to be the results from calling the returnValue function. When you call the returnValue function, make sure to pass in any string you'd like for the parameter.
It states AFTER your newly created returnValue function.
This means its looking for you to create your echo variable outside the function.
function returnValue(length){
return length;
}
var echo = returnValue('test string');
Steven Parker
231,236 PointsThe function you create in task 1 should remain as-is for task 2. The task 2 code will be added after the function and not inside it.
You just need to create and assign the "echo" variable by calling your function. So task 2 can be a one-liner.
I'll bet you can do it now without a code spoiler.
Andrew Hickman
Full Stack JavaScript Techdegree Student 10,013 PointsHey Brian! The challenge asks you to create a variable (echo) in the global scope AFTER the returnValue function. var echo should equal the returned value of the function:
function returnValue(length){
return length;
}
var echo = returnValue('50');
Brian Johnson
Front End Web Development Techdegree Graduate 20,818 Pointsthanks everyone! i got it now