I have a problem, I don't know why if I call tab[4]()
or any other number <0,9> the result in the console is always 10.
I was guessing the result for i
would be i
var tab = [];
for (var i = 0; i < 10; i++) {
tab[i] = function(){
console.log(i)
}
}