Wrong Code? Why?



The exercise asks for the code to print the dialog when the condition is met. When I enter the parameter, the dialog does not print. This is because I am using return in the code and not the console.log. Why is the exercise asking me to enter the code wrong? When I do it the way it wants, I get the number entered instead of the dialog.

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!");   



two things, first:

a function only calls when executed, you never call the function, so the function never executes

return is perfectly fine? To log what the function returns do console.log(functionCall()), where functionCall() is the actual function call


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