Functions 12: Only calls function once


The function only prints out the last time that I called it. I would expect it to print the first string, then skip a line and print the second string, then skip a line and print the first one again, corresponding to the three times the function was called and the varying numbers passed into the function. What would make this happen?

function sleepCheck(numHours) {
    if (numHours >= 8) {
        return "You're getting plenty of sleep! Maybe even too much!";
    else {
        return "Get some more shut eye!";


to log something to the console you should console.log(), so you could call console.log() on sleepCheck(10) to log to the console what the function returns


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