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 trial

JavaScript JavaScript Basics (Retired) Creating Reusable Code with Functions Passing an Argument to a Function

james mchugh
james mchugh
6,234 Points

not sure what it is asking for

I'm suppose to create new var named echo and store the value of the results of returnValue. Then call the return value with a string of my choosing. It is telling me that I'm storing the returnValue in echo. I thought that's what I'm suppose to do. I'm not sure what it's asking for or what it is suppose to do.

script.js
function returnValue(length) {
  return length;
}
var echo = (returnValue);
returnValue('read');
index.html
<!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

Agnes Demes
Agnes Demes
6,613 Points

Hi, in the var echo declaration use the string marks. var echo = returnValue('length');

james mchugh
james mchugh
6,234 Points

Thanks Agnes that worked. I was over thinking it, and adding more lines of code than needed.

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

Maybe this can help you with the last part:

function returnValue(length) {
    return length;
}

// var echo = your-function-name-here(value-of-argument-here);

That's all you need to do.

james mchugh
james mchugh
6,234 Points

Henrik, Thanks for your help. I was adding to much code and not the equals sign.