Set the variable to different value and then try.
Result:
Starting Loop
Current Count: 0
Current Count: 1
Current Count: 2
Current Count: 3
Current Count: 4
Current Count: 5
Current Count: 6
Current Count: 7
Current Count: 8
Current Count: 9
Loop stopped!
Đặt biến vào giá trị khác nhau và thử thử .
The do . while loop is similar to the while loop except that the condition check occurs at the end of the loop. This means that the loop will always be executed at least once, even if the condition is false .
Implementation diagram
Here is the do-while loop implementation diagram:
Syntax
Do . while loop syntax in JavaScript is as follows:
do { Statement ( s ) to be executed ; } while ( expression );
Note - Don't forget the semicolon used at the end of the do . while loop.
For example
Try the following example to learn how to execute a do . while loop in JavaScript.
You should read it