I want to alert variable after every 3 seconds if modulus is 0.
5,10,15,20 delay for 3 seconds 5,10,15,20 delay.........and so on
5 delay 3 seconds 10 delay 3 seconds 15 delay 3 seconds and so on
The Above issue is solved. Now the issue is that i want to execute a .bat file but it only works for ht first loop value
$(document).ready(function(){
var a = 3;
var b = 0;
for (var i = 0; i < 9; i++) {
(function (i) {
setTimeout(function () {
if (i % a == 0) {
var c = b + 5;
b = c;
<?php echo exec('abc.bat'); ?>
} else {
}
}, 3000*i);
})(i);
};
});
var a = 5;
setInterval(function() {
console.clear();
console.log(a);
a += 5;
}, 3000);
Your problem is that you put the console inside the loop, and you put the loop inside the interval which will execute all the numbers in every interval.