Can't figure out whats wrong on 12/13


#1

im having trouble with my syntax, and i cant figure out what's wrong. it always prints an extra "Youre getting plenty of sleep",
// Write your function below.
// Don't forget to call your function!
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(8);


#2

Do you have a problem with your syntax, meaning you get a syntax error or do you just get an unexpected output?

For the output well you don't output anything by console.log so what you see is just a console feature echoing your last value in your case sleepCheck(8);


#3

Hi there,

Just running this code on my end, it looks like a silly mistake* is causing you not to pass.

The course exercise is expecting you to pass through:
"You're getting plenty of sleep! Maybe even too much!".

But your code is passing:
"You're getting plenty of sleep! Maybe even too much".

In order for me to pass the exercise with your code, all I had to do was add the exclamation mark at the end of the sentence.

It doesn't actually look like the rest of your code is at fault, so give that a try!

*Just to clarify, silly mistake on the course's end not yours!


#4

The test function is probably just checking:

if(userOutput == expectedOutput){pass}

So any tiny typo makes a difference and your better of copy and pasting the sentences from the instructions.