How can I save the foo variable (in this case a function) after the page gets reloaded? How can I call foo after the page was reloaded automatically?
var foo = function() {
if(bar){
location.reload();
console.log('reload');
}else{
console.log('do something');
//do something
}
};
foo();