Lets say we have this code that I don't have access to/ I cannot change.
function f() {
// bad tasks
}
setInterval(f, 10000);
I want to modify function f so I write something like this underneath.
window.f = function(){
// good tasks
}
But the original function f()
with bad tasks
in it are still running every 10 seconds. Seems like the function passed into setInterval
is still pointing to the original function.
How do I stop it?