I'm having trouble with my code in Javascript...it's for the lesson with Functions and if/else


#1

// Write your function below. 
// Don't forget to call your function!
var sleepCheck function (numHours) {
if (sleepCheck >= 8) {
    return "You're getting plenty of sleep! Maybe even too;           much!";
}
else {
    return "Get some more shut eye!";
}};
sleepCheck(5);

#2

var sleepCheck function (numHours) {

should be

var sleepCheck =function (numHours) {

and

if (sleepCheck >= 8)

should be
`
if (numHours >= 8)


#3

I'm still getting an error message now...it says "sleepcheck is not defined"

// 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);

#4

The third call to sleepCheck(arg) has been misspelled.

also if you want to see the result of calling the function then you should try

console.log(sleepCheck(10));

#5

Holy Moly! Thank you so much!

Mark Wojciechowski


#6

Im having an issue here too... But the code is good I think.
I have a return of
It looks like sleepCheck() isn't returning "You're getting plenty of sleep! Maybe even too much!" when numHours is 10. Check your if / else syntax and whether you're using the correct comparison operator.


#7

Looks ok as well so it's probably a typo in the output message. First guess would be to start a sentence with an uppercase letter.


#8

Lower case 'y' first sentence... I did not see it. Thank you so much!