Just curious, why did I have to call this function with console.log if it wasn't necessary in some of the previous exercises


// Write your function below. 
// Don't forget to call your function!

var sleepCheck = function(numHours)
if( numHours >= 8)

return "You're getting plenty of sleep! Maybe even too much!";


return "Get some more shut eye!";

Replace this line with your code.


It is so the return value gets printed to the display.


Thanks so basically if there was no return value I could call it by simply writing sleepCheck();?


The function can be run without logging the return value, yes.

var five_hours = sleepCheck(10);
console.log(five_hours);         // Get some more shut eye!


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