for(var i = 0; i < 10; i++){
img[i] = new Image();
img[i].onload = function(){console.log(i); myFunc(i)}; // 10 every iteration
img[i].src = someUrl;
}
I need to start myFunc with index of the current img. But when the myFunc started i is already 10. How can I do what I whant?