while

while executes a loop when the condition is true.

It is similar to a for loop but has different syntax.

Syntax

while(condition)
{
    code
}

Examples

Internal

do while

for

for in

for of

External

Mozilla Developer Network

Home Menu