The else Statement in JavaScript
Else Statement
As we know, the if statement will be executed only when the given condition in the if block is true, however, if the condition inside the if block is false, then the else block will be executed.
Syntax:-
if(condition==true){
// code executeds
} else {
// code executes if condition not satisfied above
}