I have an issue in javascript and cannot solve it. My issue is how to block javascript code in a browser. For example:
var i = 0;
function process(){
if (i < 5){
i++;
setTimeout(process, 1000);
}else {
console.log(i);
}
}
process();
I want the result of this code to print 5 but when it display 1. Thank all i found my solution.