Loop
Names and abbreviations on this page
MDN — MDN Web Docs (formerly Mozilla Developer Network). Reference material for web programming.
Programming terms & practical skills
What it means
A loop repeats instructions while a condition holds or for each item in a collection. It helps avoid writing the same operation many times. The program needs a clear way to finish the repetition.
Related skills
Choose the sequenceIdentify the collection or count to process.
Track progressCheck how the current item or counter changes.
Plan the endEnsure the loop stops and handles an empty collection.
An everyday example
To total five monthly expenses, process each expense once and add it to a running total. Then compare the result with a hand calculation to catch an item counted twice.
What to check
A loop that never reaches its stopping condition can freeze a page. Test with a small, understood collection first.