Crashes Every Time I go to Submit


Nothing is behaving incorrectly, or atleast I dont think so since its just freezing every time I hit submit.

// Write your function below. 
// Don't forget to call your function!
var sleepCheck = function(numHours) {
    if(numHours >= 8)
    console.log("You're getting plenty of sleep! Maybe even too much!");
    console.log("Get some more shut eye!");


HI you should put this line


Outside the sleepCheck function then change all the console.logs with return


This worked, I just wish I understood why.


It's because of this line


it's the function call so you can't put it inside itself (There are some case that you can do it) but this isn't one of it.

var sleepCheck = function(numHours) {
   #here your code

#call the function sleepCheck here


Ok thank you, I understand now :heart_eyes:


Did you mean to write, function call?


...........Yes I do .....


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