Sleepcheck


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661


It says "Oops, try again. It looks like sleepCheck() isn't returning 'You're getting plenty of sleep! Maybe even too much!' when numHours is 10. Check your if / else syntax and whether you're using the correct comparison operator."


// Write your function below. 
// Don't forget to call your function!
function sleepCheck(numHours){
  if(numHours >=8){
    return "You're getting plenty of sleep! Maybe even too much";
  } else{
    return "Get some more shut eye!";
  }
}
console.log(sleepCheck(10));
console.log(sleepCheck(5));
console.log(sleepCheck(8));


#2

@catherine77
Read the Oops message carefully,
and compare their text with yours !!!!!


#3

Hi Cathrine,

Why do you have a second ) after console.log(sleepCheck(10))?

Have you tried removing those?


#4

@baastje
1 ) is of the console.log()
1 ) is of the sleepCheck(10)


#5

I wrote my code like that:
var sleepCheck = function(numHours) {
console.log(sleepCheck(15))
if (numHours >= 8) {
return "You're getting plenty of sleep! May be even too much" ;
} else { return "Get some more shut eye!" ;
}

}
It allows me to move to the next, but it doesn't show me any result !


#6

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