Comparison Operators


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-javascript-control-flow/lessons/control-flow/exercises/comparison-operators?action=lesson_resume&course_redirect=introduction-to-javascript

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
Did you create an ‘if/else’ statement and check if hungerLevel is greater than 7?

let hungerLevel = 5;

if(hungerLevel > 7)
  console.log('Time to eat!')
else
  console.log('We can eat later!')

Output: We can eat later!


#2

your if and else clause are a single line, so the curly brackets aren’t needed, but unfortunately to get passed the exercise you do need them.


#3

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