I am reading a tutorial and keep getting stuck on the first line of code, I know “new” in php is to make an object, but this tutorial has nothing to do with that. please help
var img = new Image();
the tutorial is here:
http://jqueryfordesigners.com/image-loading/
Ok, I found the W3 definition of the predefined javascript object Image(): http://www.w3schools.com/jsref/dom_obj_image.asp
Actually, in JavaScript
newis used when making objects too, just like PHP.As you can guess, therefore, that line of code simply instantiates an
Imageobject and assigns it to theimgvariable.