Help please. I can't figure out why this doesn't work?


#1

let hungerLevel = 7;
if (hungerLevel > 7) {
console.log (‘Time to eat!’);
else {
console.log (‘We can eat later’);
}


#2
if (condition) {
  // do something
} else {
  // do something else
}

#3

You have forgotten to add a closing curly brace after “console.log (‘Time to eat!’);”


#4

Hello!

The closing curly brace after
console.log('Time to eat!');

So instead, it would be this if I’m not mistaken:

let hungerLevel = 7;
if (hungerLevel > 7) {
console.log (‘Time to eat!’);
else {
console.log (‘We can eat later’);
}
}

I hope this helps =)


#5

Hey @trevorhodges,

Careful with your code right there. Read it over :wink:


#6

Don’t tell me I messed up =(

Lemme guess if I’m wrong this:

let hungerLevel = 7;
if (hungerLevel > 7) {
console.log (‘Time to eat!’);
}
else { console.log (‘We can eat later’);
}