for (var i = 0; i <= 5000; i++) {
if(i % 5 == 0){
setTimeout(function() {
console.log(i);
}, 5000);
}
else{
console.log(i);
}
}
I want that once it reaches to number 5 then wait 5 seconds before displaying number 6 in the console. How can I achieve this?