How to clear interval in JavaScript

Functions
By Vijay Singh · 
Last updated Jan 28, 2019
const intervalId = setInterval(() => {
  console.log("I will not be printed");
}, 2000);

clearInterval(intervalId);