Stuck on functions and if/else


#1



https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661#


Stuck on functions and if/else. What's wrong with this code?

Codecademy says it's not returning "You're getting plenty of sleep! Maybe even too much!" when numHours = 10
No error messages

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


#2

HI try to refesh the page..


#3

@matteo321,

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


#4

Didn't work. Oh well, think I'll move on to the next exercise. Pretty sure the code is right. Thanks for the help, though.


#5

Yeah, I did both. Although, didn't know the command for refreshing. You learn somethng new every day! :slight_smile: