Bloqueo erróneo?


#1

Buenas tardes desde España. He introducido este script y me da error. Lo curioso es que en otro IDE funciona perfectamente. Alguien puede ayudarme? Estoy bloqueado y no puedo avanzar... Muchas gracias!
controlDescanso = function(cantHoras){
if (cantHoras>=8){
return console.log("¡Estás durmiendo suficiente!, Demasiado quizás.");
}
else
{
return console.log("cierra los ojos un poco mas!");
}
};
controlDescanso (10);
controlDescanso (5);
controlDescanso (8);


#2

@lluisribas,

1

Your return statement should return a string VALUE ( not a console.log() )

2

You should return the EXACT text's as are mentioned in the Instructions

3

Always use the var keyword when defining a variable like var controlDescanso

var controlDescanso = function (cantHoras) {
  if (cantHoras>=8) { 
    return "¡Estás durmiendo suficiente!, Demasiado quizás.";
  }
  else
  {
    return "cierra los ojos un poco mas!";
  }
};
console.log( controlDescanso(10) );
console.log( controlDescanso(5) );
console.log( controlDescanso(8) );

console.log( "== My End ==" );
console.log( "== All that is displayed now, is the course-checker ==" );

#3

@lluisribas,

function with 1 parameter using return-statement

var myFunction = function( param1 ) {
       //Begin of FUNCTION-BODY
       //myFunction =function= has 1 PARAMETER param1
       //this param1 PARAMETER is used as a -local- VARIABLE
       //throughout the FUNCTION-BODY

      return param1;

      //End of FUNCTION-BODY
      };

you have defined a myFunction function
which takes 1 parameter param1
this param1 parameter is used
as a variable throughout the FUNCTION-BODY.

If you want to call/execute this myFunction function
and this myFunction function was defined
as having 1 parameter param1
you will have to provide 1 argument
in our case a "number VALUE" 4
myFunction( 4 );

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**