Loops are important to writing your JavaScript code because they allow you to repeat codes. Loops help with when you want to repeat a code, the loop makes it easier to shorthand a way to write the code simply. The goal of a loop is to write out instructions until a condition is completed. They are used to complete true or false responses. So, for multiple situations you may be needing to find out if something is true or false using slightly different data, you would use your loop to create the statement and then add your data to the one loop to find multiple answers.
A for loop is used for when we have a specific number of times to run the code. The beginning part of the code that begins “for(){“, allows us to insert information on when the loop code should run and how many times it is needed. If we did not know how many times, we would use a while loop instead.
This made it very easy to visualize how loops are used and how they actually work.