I have a recursive function reopen()
which is supposed to loop indefinitely however after calling the function openWin()
it stops for some reason.
Here is the code:
function openWin(i = 0) {
win[i] = window.open(url,'', 'width=200,height=200');
wins++;
}
function reopen() {
for(var i = 0; i < wins; i++) {
if(win[i].closed) {
openWin(i);
openWin(wins);
}
}
setTimeout(reopen, 10);
}
Any idea why this is happening and how to fix it?
EDIT: A lot of people seem to think that the problem is coming from calling openWin()
twice, however it has the exact same problem when only calling it once