12. Functions & if/else SITE CRASHES


#1

Whenever I click "submit code" the site stops working and eventually crashes. It works if there's a mistake in the code but as soon as I put in this version (below, might not be correct but thats not really my problem now) it just crashes on me and I really need to finish it. Any ideas?


var sleepCheck = function(numHours){
    if(numHours >= 8){
        console.log("You're getting plenty of sleep! Maybe even too 

much!");
        }
    else {
        console.log("Get some more shut eye!");
        }
    sleepCheck(10);


#2

where is the } to close your function?


#3

I didn't notice that, thank you. :slight_smile: I actually managed to fix it and it works now but I still don't understand why would THAT crash the whole site...


#4

yea, that particular exercise is pretty sensitive to this, recent someone had:

else
console.log("Get some more shut eye!");
 {
        
        }

this also caused the browser to crash, given that was the same exercise, i suspect something in SCT (submission correctness test) which cause the browser to crash


#5

Ooh, I see. Thanks again!


#6

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