Functions if/else recap false error


I keep getting an error on my code and I can't place what is wrong. The error says it's not returning, but it is printing the correct messages on the console. Doesn't that indicate that the function is in fact returning?

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.

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



all that extra white space between too and much is that also in your code like that or a copy/paste mishap?

Also, the task doesn't say you have to console.log the result, maybe that is tripping it up


It was in the code. I took it out but I still get the same error


try removing the console.logs and just call the function


Took them out, same errors
But the fact that it's still displaying in the console mean's that it's returning right?


In cases like this it's most often spelling or white space errors. The "error checker" is looking for excactly the same string as specified in point 02.

My eyes are too tired to distinguish fine detail. Try copy pasting the string form 02.


I was a spelling error :smile:
I guess my eyes are tired too!
Thanks for your help!


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