Is this the corrected outcome to this exercise?


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
Functions & if / else
https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661#

<In what way does your code behave incorrectly? Include ALL error messages.>
I have passed this test but it has printed all three. Is that the desired answer for this task or was it only meant to get one of them? I guess I never actually specified one…
Can you guys just confirm this is correct and not a bug.

Thanks in advance!

```

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

console.log (sleepCheck(10));
console.log (sleepCheck(8));
console.log (sleepCheck(5));

<do not remove the three backticks above>

#2

I now see why… I asked for 3 at the bottom. Need to go to sleep before I think too much about this.


#3

Well, you did specify to log all the three at the bottom of your code:

console.log (sleepCheck(10));
console.log (sleepCheck(8));
console.log (sleepCheck(5));

That’s why it got printed as well :slight_smile: