Web Developer

What is a loop

A loop in JavaScript allows you repeat a section of code a certain number of times which is useful if you want to shorten your code or change some of the variable values for example. By using loops you also avoid typing errors in the repeating lines of code.