How to stop Javascript setInterval

Stopping or cancelling a setInterval call in Javascript involves using clearInterval. You must however use clearInterval on a variable that is assigned to the setInterval you want stopped. setInterval calls…