JavaScript while Loop
JavaScript while Loop
The while statement is used for creating a loop that is executed while a condition is true. When the condition becomes false, the loop will end.
Syntax:-
Its syntax is:-
while (condition) {
code block to be executed
}
Further Explanation:-
Parameter | Description |
condition | Required. The condition for running the code block. |