1// This will be repeated 5 times with 1 second intervals:
2setIntervalX(function () {
3 // Your logic here
4}, 1000, 5);
1var x = 0;
2var intervalID = setInterval(function () {
3
4 // Your logic here
5
6 if (++x === 5) {
7 window.clearInterval(intervalID);
8 }
9}, 1000);