162
rated 0 times
[
164]
[
2]
/ answers: 1 / hits: 54983
/ 13 Years ago, thu, september 15, 2011, 12:00:00
I have a JS function where a value is computed and this value should be returned but I get everytime undefined
but if I console.log()
the result within this function it works. Could you help?
function detect(URL) {
var image = new Image();
image.src = URL;
image.onload = function() {
var result = [{ x: 45, y: 56 }]; // An example result
return result; // Doesn't work
}
}
alert(detect('image.png'));
More From » image