Learn Create Your Own Split Screen

Next Page

Instead of a "forever" loop, in Javascript we use timers. A timer is just something that causes an event to occur at some point in the future. There are two types:
Timers need two things to make them work: The "500" in the call to setInterval is how long between each "tick of the timer", expressed in millseconds -- thousandths of a second. 500 milliseconds is half a second.