Loop statement

단단한어린이·2022년 4월 5일


목록 보기

for statement

for ... in // Object
for ... of // Array values

while statement

The while statement repeats the code block repeatedly if the evaluation result of a given conditional expression is true. If the evaluation result of the conditional statement is false, the execution is terminated. If the result is not a Boolean value, it is forcibly converted(Type coercion) to a Boolean value to distinguish logical true and false.

To escape the infinite loop, the code block escape condition is given to the if statement and the code block is escaped with the break statement.

do while statement

The do…while statement executes the code block and evaluates the conditional expression. Therefore, the code block is executed more than once unconditionally.

continue statement

The continue statement is a repeat statement(for, for…in, for…of, while, do…while). And terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration.

Footprints in Coding

0개의 댓글