Comparison operations help!


#1

I am on the problem using if/else- I started off fine using this;

var hungryLevel= 5;
if (hungryLevel>7) {
console.log('Time to eat!');
} else {
console.log('Let\'s eat later.');
}

the program gave me a check then gave me next directions;
Notice that since hungerLevel is 5, the if statement evaluates to false, therefore the else's code block runs.
Now set the hungerLevel variable equal to 10 and run your code again.

so I put in;

var hungryLevel= 10;
if (hungryLevel>7) {
console.log('Time to eat!');
} else {
console.log('Let\'s eat later.');
}
- keeps telling me I am incorrect and asking me if I set the hungrylevel variable to a number; however it is working- Does anyone know how to fix this or what I am doing wrong! I would love to continue on but it won't give me the code either! :confused: Thank you!!!


#2

I think they want you to reassign the variable like so:

var hungryLevel = 5;

hungryLevel = 10;

So that you see that you can change the value stored in the variable. Try that.


#3

Thank you so much!! It was driving me crazy! :joy:
It worked!!


#4

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