Chapter 5Loops and Jumps
This chapter introduces loop and jump statements. A loop statement is used when we want to repeat some programming statements until a specified condition is reached. A typical example would be to iterate through a list and perform an operation on each member of the list. A jump statement allows code to exit loops. One example is to loop through our to-do list and then break out of the loop upon reaching the first incomplete item. There are various types of jump statements, which we’ll explain as we go along.
Loops are generally associated with a particular style of programming known as imperative programming. Here, the programmer specifies step by step how a program should achieve a particular task. An alternative approach ...
Get Jump Start JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.