Fuction if/else 12


#1

Hi, am stuck on this. Can't see why

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

console.log(sleepChek(10))
console.log(sleepChek(5))
console.log(sleepChek(8))

#2

Hi,

do not use "console.log" in this task(it is not required here), just call the function "sleepCheck(someParameter);"!

Here is your corrected code for this task:

// Write your function below.
// Don't forget to call your function!
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!"
}
}

sleepChek(10);
sleepCheck(5);
sleepCheck(8);
//sleepCheck(10);

If you have more questions, I'll be glad to help you! :slight_smile:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.