12. Functions & if/else - where am I going wrong?



I can't seem to get this right. I either have an unexpected token, wrong syntax, or it thinks I'm using the wrong comparative operator. I've looked at other answers but I just can't seem to figure out what I'm doing wrong.

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!";
console.log (sleepCheck(10));
console.log (sleepCheck(5));
console.log (sleepCheck(8));



See amendments I have made above :slight_smile:


I tried this and thankfully the desired results appeared - however, it still reads at the bottom "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."


Copy and paste this sentence from the instructions, this exercise is really picky about punctuation/spacing/grammar.


Thanks! I have a habit of putting 2 spaces between sentences. Deleting one between "sleep" and "Maybe" solved it :smiley: