Why does this code log the output "5" instead of "0", or "4" for that matter?
var arr = [];for(var i =0; i< 5; i++){ arr[i] = function(){ console.log(i); }}arr[0]();
Aucun commentaire:
Enregistrer un commentaire