I only know 1, some old version of the browser does not support the new Image (); 2, when creating more img tags, new Image () with good performance, faster,
Other places have what different? thank you
CodePudding user response:
Should be the sameCodePudding user response:
The Image () constructor creates a new HTMLImageElement instance.It is functionally equivalent to the document. The createElement method (" img ").
The function is equal, there is no other difference, from the MDN document
CodePudding user response:
Found a difference, the new method to create the img will automatically add width and height properties, while the createElement method not create img.CodePudding user response: