Function If/Else


#1

12.Function & If/Else
https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661

Oops, try again. There was a problem with your syntax.

I am really confused. I've been searching through many different questions trying to find ways that i have been incorrect but I haven't found anything wrong. I am genuinely confused and looking for an explanation. Not code. Thank you for your time anyway.

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

sleepCheck(10);
sleepCheck(5);
sleepCheck(8);


#2

@333152,
An ELSE statement

else (numHours < 8) {

does NOT take a condition

else {

#3

@leonhard.wettengmx.n
Thank you so much. It worked.