var index = 0;
var length = ["a", "b", "c", "d", "e"].length;
var interval = setInterval(function() {
if (index < length) {
console.log(index);
console.log(length);
index++;
} else {
clearInterval(interval);
}
}, 1000);
Is there a solution to ensure that the interval clears at 5:5 instead of 4:5?