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

Passing Argument to a function [test] PLEASE HELP!!!

Simply i dont get what i have to do here i try it for 2 hours...

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.

The function will accept the string you pass to it and return it back (using the return statement). Then your echo variable will be set with what is returned, the results.

function returnValue (numero){
  var echo = numero;
return echo;
}
returnValue ('Hola');

Hola Carlos voy super bien en le curso pero la parte de functions me esta rompiendo la cabeza y no lo logro eh visto casi 10 videos sin lograr comprender.

1 Answer

Hey Alejandro, I think this is more a problem of understanding the question than you doing something wrong.

I this case you have to create a variable called echo and set its value to be the returned value of the function call. Like this:

function returnValue(numero) {
   return numero;
}

var echo = returnValue(1);

Try that and let me know!

Thank you was dificult to read but easy to apply.

Can you tell me what is wrong here? i Don't get the result of 20

function valores (valor1, valor2){
suma = valor1 + valor2 ;
  return suma;
}

document.write ('<h1>' + suma + '</h1>' );

valores (17,3);