1
I have a function to upload images and for now the imgs array is going to global scope, but I wish this function could return this array:
function loadImages () {
imgs = [];
for (var i in arguments) {
var start = arguments[i].lastIndexOf("/") + 1;
var end = arguments[i].indexOf(".");
var name = arguments[i].substring(start, end);
imgs[name] = new Image();
imgs[name].src = arguments[i];
}
}
after for add: Return imgs;
– Bsalvo
I managed to settle by changing at first to var imgs = new Object() and in the end the Return imgs
– user83428