Functions & if/else


#1


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


The function even though it is returning the string but an error message is displayed saying the function isn't returning the string check the comparison operator and the if/else syntax


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

The string returned should be an exact match, copy paste the string from the instructions


#3

okkk... gotchaa...thankss :slight_smile:


#4

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