Internal Error: Too Much Recursion


#1



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


Im getting an error (Internal Error: Too much recursion). Can anybody please help!


var sleepCheck=function(numHours) {
    if (sleepCheck()>=8) {
        console.log("You're getting plenty of sleep! Maybe even too much!");
    } else if(sleepCheck()<=8) {
        console.log ("Get some more shut eye!");
    }
        else {
            return false;
    }
}
sleepCheck(5);


#2

@bitcoder43203

You are calling sleepCheck function inside itself and you can't do that. Replace sleepCheck with numHours (the optional parameter of the function)


#3

Thanks miniapple8888, that helped...now I have another issue..that will not let me pass...can you please help by looking at the error dialog below..thanks


#4

@bitcoder43203

Here you are using console.log function not return function


#5

Thanks again miniapple8888, im such a noob!