If/else function error message


#1


Hello, someone take a look at this and tell me why I keep getting an error message? I saw an earlier question about the same exercise I was doing and I duplicated everything, but I'm still getting an error. Please help.


Replace this line with your code.


#2

remove all the ; after }


#3

Thank you for the suggestion, but I am still getting an error. So frustrating.


#4

The program doesn't know what to apply the if/else statement to because you're forgetting to wrap your inner function in curly brackets:

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

console.log(sleepCheck(2));

#5

You're amazing, thank you!


#6

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