Introduction
setInterval lets you run a task repeatedly every set time. clearInterval stops that repeated task.
You want to show a clock that updates every second.
You need to check for new messages every few seconds.
You want to repeat a task until a condition is met.
You want to animate something by updating it regularly.