Lesson 12


#1

SyntaxError: unterminated string literal

var sleepCheck = function (numHours){
    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(5));      
console.log(sleepCheck(8));

can anyone show me whats wrong? my eyes are tired lmao


#2

As you can see already by the color, you at least didn't close your first string.


#3

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(5));      
console.log(sleepCheck(8));
  • Now I did. Its saying "SyntaxError: expected expression, got keyword 'if'"

#4

Oh you lack the {} around the code that belongs to your function.