I have read the relevant pages on w3schools and other similar questions here but cannot seem to understand what's wrong about the following bit :
var myfunc03 = function (i) {
document.getElementById('d01').innerHTML += 100-i+"<br>";
};
var myFunc01 = function() {
i=0;
while (i<100) {
setTimeout(myfunc03(i), 1000)
i++;
}
};
when myFunc01();
is run.
There's no pause whatsoever and all possible values for i is listed at once.
Is there a logical mistake here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…