12. Functions & if/else


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


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


Why does it appear Error?


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


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!";
return "Vá para a cama!";

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



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


I have problem in this code,i need help


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?


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)