SpinSpire logo

Conditional Statements and Loops

Conditional Statements

When you want to execute code only under certain circumstances, you should use conditional statements.

If statement

If else statement

Else if statement

Switch statement

Loops

When you want to iterate over a collection of items or repeat until a certain condition is met you should use a loop.

For loop

While loop

Do While loop


References:
  1. Javascript Loops
  2. Javascript Conditionals