12. Functions & if/else


#1


I don't understand what am I doing wrong..


#2

The very first line you call return, You forgot to close the string(ie. at the quotes at the end)


#3

Why does it appear Error?


#4

that string that you are supposed to be returning copy it as they gave it and paste it


#5

Sorry about my bad inglish....
But... try not use console.log in this code.
var sleepCheck = function (numHours){

if (numHours >= 8){

return "Você está dormindo o bastante! Talvez até demais!";
}
else{
return "Vá para a cama!";
}
};
sleepCheck(10);
sleepCheck(5);
sleepCheck(8);

the "return" will give the mensage on console. U dont need use console.log.

Cya.


#6

yes you need to console.log it yo see the result. Do you know what return does?


#7

I have problem in this code,i need help


#8

This shows I passed this section, Should this return all 3 sleepchecks and not just the first instance where sleepCheck(10) returns that i'm getting plenty of sleep?

I want to fully understand this function and if using the function in this way returns only the first instance, how would it return all 3?


#10

The** console.log call** is not what passing the excercise is dependent on but rather the correct implementation of the sleepCheck function.
To get access to the debugging console you need a console object

Now what you see in the debugging window when you run your call is an implicit call by codeacademy(perhaps their test function is logging it to the console)

In the function you are using the return keyword and it does not print anything to console but rather gives some value back to you(you can capture this value and manipulate it)