So, imagine the following code below:
setInterval(() => {
var thisInterval = this;
fn1();
fn2();
if(someMouseDownEventDeclaredSomewhereElse){
clearInterval(thisInterval);
}
},100);
Is this the correct method for getting the current interval? Say I wanna do so without setting a variable to this loop because I want it to be an unnamed and non-stored interval. In simpler words: Is there a way to get an unnamed interval from within, like with this or something?
You can do something like this;
function f() {
fn1();
fn2();
if(!someMouseDownEventDeclaredSomewhereElse){
setTimeout(f, 100);
}
}
setTimeout(f, 100);