Here is the image-loading construction in js:
var img = new Image();
img.onload = function(){
//do something
}
img.src = "path to image";
I'm curious way this works, that after assigning string to object some event is triggered. Could someone explain it to me?
new Image()is equivalent todocument.createElement('img').visibility:hiddenordisplay:none).