If and Else statements allow you to run code to find out if something is true or false. The simple statement to explain it is “If the condition is true, execute this code, else execute a different code. There are a number of operations you can test like:
== equal to, >= greater than or equal to, > greater, != not equal
An example of an if/else statement is:
let number = 2
if (number > 0) {
console.log(true);
}
else if {
console.log(false) ;
}
This statement would return the word “true” because 2 is greater than 0.
Hi Rachel, I do find your example of an if/else statement to be good. However, I feel like more description could have helped better understand how the statement operates in JavaScript and when to use it.