dimanche 21 août 2016

Running function a few times but why am I only seeing output being returned once?

I'm running the following code but I only see the output of the function being returned once which I've also added at the bottom, instead of 3 statements being printed out, I can't see why. I am a newbie to learning JavaScript by the way:

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

sleepCheck(10);
sleepCheck(5);
sleepCheck(9);
"You're getting plenty of sleep! Maybe even too much!"

Aucun commentaire:

Enregistrer un commentaire