JS TutorialLesson 13Free preview
JS Loops
This lesson is part of JavaScript · All levels
Summary
Loops are used to repeat blocks of code without writing them over and over again. JavaScript recognizes for for iterations with a calculator, while for condition-based iterations, and do...while that always run blocks at least once. The break statement stops the repetition completely, while continue jumping through the rest of the iteration and proceeding to the next iteration.
Key points
- For is appropriate when the number of repetitions is known from the beginning
- While repeating during the still condition
- Do... execute the block at least once before checking the condition
- Break stop the loop, continue passing to the next iteration
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.