javascript - Why is the answer to this 10? -
this question has answer here:
i know outcome of 10:
var es = []; (var = 0; < 10; i++) { es[i] = function () { console.log(i); }; } es[6](); any number of es[0] - es[9] still 10. why?
because after loop i 10. function prints reference of i.
Comments
Post a Comment