Syntax Error in code


#1

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

 console.log(sleepCheck(10));
 console.log(sleepCheck(5));
 console.log(sleepCheck(8));

error: there was a problem with syntax
plz anyone could help in this error??


#2

You don't have to console.log your function simply call the function like this
SleepCheck(10);


#3

If you want to see more than one output this is actually the way you do it. Otherwise you could just hope on the console echo for the last value. The real problem is probably that you have a condition for your else:

else(numHours <8) {

either make it else if or delete the condition.