35
rated 0 times
[
39]
[
4]
/ answers: 1 / hits: 59641
/ 8 Years ago, thu, june 9, 2016, 12:00:00
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?
More From » while-loop