var intervalId;
var runCount = 1;
function sayHello() {
if (runCount > 5) {
clearInterval(intervalId)
}
console.log(runCount, “Hello!”);
runCount++;
}
console.log(“And the wait starts…”);
intervalId = setInterval(sayHello, 1000);
why the above code printing hello 6 times?