Var sleepCheck = function(numHours){ if(numHours >=8) return "You're getting plenty of sleep! Maybe even too much!"; } else { return "Get some more shut eye!"; } } } sleepCheck(10); sleepCheck(5); sleepCheck


#1


<>
var sleepCheck = function(numHours){
if(numHours >=8)
return "You're getting plenty of sleep! Maybe even too much!";
}
else {
return "Get some more shut eye!";
}
}
}
sleepCheck(10);
sleepCheck(5);
sleepCheck(8);

I am getting a syntax error, can somebody tell me what I am doing wrong?


Replace this line with your code.


#2

you need an opening bracket after your if block like so

if(numHours >=8) {


#3

praise2014-- This is your code after correcting few errors

var sleepCheck = function(numHours)
{
if(numHours >=8)
{
return "You're getting plenty of sleep! Maybe even too much!";
}
else {
return "Get some more shut eye!";
}
}
sleepCheck(10);
sleepCheck(5);
sleepCheck(8);


#4

var sleepCheck = function (numHours) {
if (numHours>=8 ) {
return "Você está dormindo o bastante! Talvez até demais!";
}
else {
return "Vá para a cama!";
}
}
sleepCheck(5);
copie e cole "Você está dormindo o bastante! Talvez até demais!"; e "Vá para a cama!";


#5

This thread is over a year old and has been closed. To continue the discussion, create a new topic.