JavaScript if ... else

Use the else statement to specify a block of code to be executed if a condition is false.

A time-based greeting: