if

if executes when the condition is true.

Syntax

if (condition) {
  code
}

Example | True

Example | False

External

Mozilla Developer Network