I would like to know why my code is not being accepted
// this is codecademy's own code
let hungerLevel = 10;
if (hungerLevel > 7) {
console.log('Time to eat!');
} else {
console.log("Let's eat later!");
}
// this is my if statement
console.log (hungerLevel > 7 ? "Time to eat!" : "We can eat later!" )
maybe there the validation worked differently. Validating code can be done several ways, depending on how the validation is coded, which alternative approaches work
for example, if the validation runs your code, and checks that for different values of hungerLevel the correct string is logged to console, then the ternary operator would work
but if the validation check the presence of if keyword then ternary operator won’t work