I'm doing iteration, and in code last code in the iteration i put a code that will reload the page.
How to keep the JavaScript iteration running after reload and continue the state ?
E.g
for(i=0;i<5;i++) {
document.reload();
}
After running above code, the code stopped and the console reloaded .
The code above might not work, but i wish it explain what i'm trying to do .
You need to store the state in a place where it's not reset. localStorage is the ideal solution.
var i = parseInt(localStorage['i'])||0;
localStorage['i'] = i+1;
// do some stuff
// and reload if you want
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With