Check out the codepen here

back to table of contents

short explanation

A ton of things in life are constant repitition. You get up and you go to sleep. you do the everyday. If you work in an office job, you are at office, you are doing it, again and again.


Programming is essentially a reflection of life. Also, most of the time, almost every app is almost always showing a number of things which are usually part of a collection.

Like, when you open a news app, it essentially shows a long list of articles from a collection. Anytime you have kind of repitition, you use loops, specificially for loops.

Here is a code showing a loop.

for(var i=0;i<numberofloops;i++)
  //create a simple paragraph tag
  var tempp = document.createElement("p");
  tempp.innerHTML = "whats up doc?"; 
  //add it to the div

In any for loop, you will have a few common components.

important note

This code is provided as is without any warranties. It’s primarily meant for my own personal use, and to make it easy for me share code with my students. Feel free to use this code as it pleases you.

I can be reached through my website - Jay’s Developer Profile