© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
J. SimpsonHow JavaScript Works https://doi.org/10.1007/978-1-4842-9738-4_4

4. Loops and Iterables

Jonathon Simpson1  
(1)
Belfast, Antrim, UK
 

As we start writing more complicated code, it is both necessary and desired to not repeat ourselves. This concept in programming is known as DRY, or Don’t Repeat Yourself. This concept becomes really important when we're working with large datasets. For example, imagine you find yourself wanting to create 10 new rows on a table. You could write the same code ten times in a row, but that would neither be efficient nor a good use of your time.

To avoid repeating ourselves, we use loops and iteration, and JavaScript has a ...

Get How JavaScript Works: Master the Basics of JavaScript and Modern Web App Development 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.