While

var variable = 0

while(variable < 5) {
    console.log(variable)
    variable++
}
実行結果
0
1
2
3
4

While-break

var variable = 0

while(variable < 5) {
    console.log(variable)

    if (variable == 3) {
        break
    }
    variable++
}
実行結果
0
1
2
3

While-continue

var variable = 0

while(variable < 5) {
    variable++

    if (variable == 3) {
        continue
    }

    console.log(variable)
}
実行結果
1
2
4
5

do-while

var variable = 0

do {
    console.log(variable)
    variable++
} while (variable < 5)
実行結果
0
1
2
3
4