Hi I'm confused with alert
and console.log
var count = [];
function iterate(number) {
count.push(number);
for (i = 0; i < count.length; i++) {
console.log(count[i]);
}
}
iterate(2);
iterate(3);
iterate(4);
Console will give me 2,2,3,2,3,4 but when I change console.log(count[i]) to alert(count[i]); it will repeat just 2 three times, why?
var count = [];
function iterate(number) {
count.push(number);
for (i = 0; i < count.length; i++) {
alert(count[i]);
}
}
iterate(2);
iterate(3);
iterate(4);
It doesn't do that above, but it does on JSBin.