Functions and If/else error message


Even though my console correctly shows the right message, I continue to get the error message "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."

The "You're getting plenty ..." message correctly shows up when sleepCheck is 10 or 8 and "Get some more ..." correctly shows up when sleepCheck is 5; however, I continue to get the same error message and can't get through the exercise.

Any suggestions?

My code is below:

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!";


Be sure to use the exact strings given in the instructions.


I was taught to put 2 spaces between sentences. I deleted one of the spaces and it worked!



In the days previous to the web and its adopted API, HTML, the double space sentence break was standard procedure for typists. Then HTML chose to ignore extra spaces and it became nearly impossible to render both spaces in prose text on the screen (in a browser window) so folks naturally adapted to eventually only using one space in all typing, for screen or paper.


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