The function you provided counts down from 10 to 1, with a 3 second interval. If you are running that directly in the Chrome Console and you refresh your page in the middle, it will of course be killed because the function is executing in the context of the current page you have loaded.
If you want to persist the loop between reloads when the code is running within the page (not the console), then you could maintain the state of the variable when you are executing the code, e.g. in local storage or a cookie. When the page loads, use the stored value instead of the default.
Example:
window.onload = function() {
var count = localStorage.getItem('count');
if (count == null) count = 10;
(function myLoop(i) {
setTimeout(function() {
localStorage.setItem('count', (i-1));
console.log(i);
if (--i) {
myLoop(i);
} else {
localStorage.removeItem('count');
}
}, 3000)
})(count);
}