An if else statement is a way of checking something in your JavaScript code. I we want to know if a number is equal to 5, we can use an if else statement. If we were to be speaking this in English, and not in JavaScript, it would sound like: if this number is equal to 5 then do something, if not then do something else. I JavaScript it would look like:
In the example below our “5” is a “10”
This code consists of four parts. 1) line one is the if statement. 2) “thisNumber == 10” is the Boolean expression. 3) “==” is the operator. 4) else statement is in line three.
An else statement is not necessary. You could just have an if statement, or several if statement in a row.
I didn’t realize that we could have an if statement without an else statement, that is something so good to know. I found the if/else statements to be quite easy because all you really have to do is fill in based on the standard “formula” of writing one out like you mentioned as the four parts.