Preview:
IF STATEMENT
if (expressions) {
  Statment(s) to be executeed if expression is true
}

IF AND ELSE STATEMENT
if and else statement (expression) {
    Statement(s) to be executed if expression is true
    } else {
    Statement(s) to be executed if expression is false
    }

IF AND ELSE IF STATEMENT
if (expression 1) {
Statement(s) to be executed if expression 1 is true
} else if (expression 2) {
Statement(s) to be executed if expression 2 is true
} else if (expression 3) {
Statement(s) to be executed if expression 3 is true
} else {
Statement(s) to be executed if no expression is true
}

SWITCH STATEMENT
  switch (expression) {
case condition 1: statement(s)
break;

case condition 2: statement(s)
break;
and so on...

case condition n: statement(s)
break;

default: statement(s) 
}

WHILE STATEMENT
while (expression) {
Statement(s) to be executed if expression is true
}
example:
function score(score) {
    while (score < 20) {
        console.log("You failed nigga", score);
        score++;
    }
}

FOR LOOP STATEMENT
for (initialization; test condition; iteration statement) {
Statement(s) to be executed if test condition is true
}	
example:
for (let i = 10; i >= 1; i--) {
    if (i % 2 !== 2) console.log(i)
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter