if keyword followed by a set of parentheses () which is followed by a code block, or block statement, indicated by a set of curly braces {}.(), a condition is provided that evaluates to true or false.true, the code inside the curly braces {} runs, or executes.false, the block won’t execute.An else statement must be paired with an if statement, and together they are referred to as an if...else statement.
the and operator (&&)
the or operator (||)
the not operator, otherwise known as the bang operator (!)
Less than: <
Greater than: >
Less than or equal to: <=
Greater than or equal to: >=
Is equal to: ===
Is not equal to: !==
let sale = true;
sale = false;
if(sale) {
console.log('Time to buy!');
} else {
console.log('Time to wait for a sale.');
}
let hungerLevel = 7;
if (hungerLevel > 7) {
console.log("Time to eat!");
} else {
console.log("We can eat later!");
}