Java Script : comparison Operators help

I’m having difficulties with this exercise as the program tells me that the variable “hungerLevel” ,in the first line, is not defined, I cannot find what I am doing wrong and any help would be greatly appreciated.

var hungerLevel = 5
if (hungerlevel > 7) {
console.log(“time to eat!”);
} else {
console.log(“let/'s eat later.”);
}

1 Like

Check if there is some misspelling :wink: (just go through the code again)

2 Likes

Hi,
I am a Casino Game Developer, while going through JavaScript tutorials, I came across ur issue… I run ur code and found two issues: hungerLevel is written as hungerlevel… see JS is case sensitive so it will treat these both as two diff variables. Also, there is a syntax error of semicolon at var declaration. Please try to run this code:
var hungerLevel = 5;
if (hungerLevel > 7) {
console.log(“time to eat!”);
} else {
console.log(“let/'s eat later.”);
}

It will print Lets eat later… Hope it helps.