let hungerLevel = 7;
if(hungerLevel > 7){
console.log(‘Time to eat!’)
}else{
console.log(‘We can eat later!’)
}
Hi, I am a bit confused about the difference between ‘=’ and ‘<=’. when I saw the explanation that shows it is greater or equal, I practiced using it, the result was just equal which was true, and ‘Time to eat!’. Wondered when I need to use ‘<= ’ or ’ =>’ since the result becomes equal. Thank you in advance.
An assignment is always right to left. The value on the right is assigned to the variable on the left.
Inequality operators:
< less than (or comes before)
> greater than (or follows after)
!== not identical to (strict type match and value)
!= no apparent similarity (uses coercion)
as well as partial inequality:
<= less than or equal to
>= greater than or equal to