Need help with comparison-operators

var hungerLevel = 7;
if (hungerLevel > 7) {
console.log(“Time to eat!”);
} else (hungerLevel < 7); {
console.log(“We can eat Later!”);
}

Hey, @redorblue welcome to the forums.

Can you please elaborate on what you are having trouble with? And if it is with a lesson/project please give us the link.

I’m having trouble with the code when I try to use the code it only puts out " We can eat later!" I’m not sure what I’m doing wrong.

@not-ethan I need help

You cant have an else statement with a condition. And if you change hungerLevel to a number larger than 7 it will print Time to eat!.

@not-ethan this is what I have now - When I change the number in line two, from 7 to 10 " if(hungerLevel > 10) {" it shows the “We can eat later!” sign but the instructions says it is wrong.

var hungerLevel = 10;
if (hungerLevel > 7) {
console.log(“Time to eat!”);
} else {
console.log(“We can eat Later!”);
}

@not-ethan Sorry to bother you I figured it out now.

aromalampa
https://svadia.se/products/elephant-aromalampa