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

i dont understand what is wrong,can someone help me?

i dont even understand all the question

function returnValue (vacilão){
  var echo = deus;
  if (echo === vacilão){ 
  return vacilão;
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>
Kieran Barker
Kieran Barker
15,028 Points

I haven't reached this far in the course, or looked at the challenge in depth, but could it be because you have a special character in your code (ã)? Try replacing it with a regular 'a' and see what happens :-)

Christopher Phillips
Christopher Phillips
10,061 Points

The challenge first asks you to define a function named returnValue , assign it any single argument, and then returning that argument:

function returnValue(vacilão){

Next it wants you to create a new variable, echo, and have that value be assigned the result of the returnValue function with any string. That would make it:

function returnValue(vacilão){
var echo = returnValue("test");

So echo is going to be created, and then defined by the result of "test" passing through returnValue

1 Answer

Charlie Gallentine
Charlie Gallentine
12,092 Points

The challenge first asks you to create a function which takes one argument and returns the argument immediately:

// Name a function: "returnValue" which takes one parameter
function returnValue(argument) { 
     return argument;  // Returns the argument when the function is called

You are then asked to create a variable: "echo" which is the result of calling that function and passing any string you'd like as the argument:

var echo = returnValue("My argument"); // Creates variable "echo" and assigns it the value of returnValue(argument)

So the total result looks like:

function returnValue(argument) { // Names a function: "returnValue" which takes one parameter
     return argument;  // Returns the argument when the function is called

var echo = returnValue("My argument");

Also, I am not sure, but I think that 'ã' counts as a special character. I would try running the script without it and just using the letter 'a' or any other un-augmented character.