I have a function that is triggered using .onload. I'd like return a value:
newImg.onload = function() {
var height = newImg.height;
var width = newImg.width;
if(height > width){
console.log(false);
return false;
} else {
console.log(true);
return true;
}
}
newImg.src = imgSrc; // this must be done AFTER setting onload
Normaly I'd do something like
var foo = function(){...
but this doesn't work in this case. What should I do instead?