1.

How do we create and preload an image object in JavaScript?(a) Use new keyword(b) Call Image()(c) Both Use new keyword and Call Image()(d) Set image()This question was addressed to me in final exam.I would like to ask this question from Animation in section Caching, Debugging and Animation of JavaScript

Answer»

The correct answer is (C) Both Use NEW KEYWORD and Call Image()

Easiest explanation: The Image() CONSTRUCTOR creates and preloads a new image object. The url is SPECIFIED and the image is preloaded.



Discussion

No Comment Found

Related InterviewSolutions