Expert Developer JavaScript Question: Download Questions PDF
What is the difference between window.onload and onDocumentReady?
![Expert JavaScript Developer Interview Answer Expert JavaScript Developer Interview Question](https://globalguideline.com/public/images/interview/22.png)
Answer:
► The difference is that onDocumentReady is called after the DOM is loaded without waiting for all the contents to get loaded. While window.onload() function waits until the contents of page is loaded.
► Suppose there is very large image on a page, at that time onDocumentReady will wait until that image is loaded totally.
► So while using the window.onlaod() function the execution will be slow, but the onDocumentReady will not wait until the image is loaded.
► Suppose there is very large image on a page, at that time onDocumentReady will wait until that image is loaded totally.
► So while using the window.onlaod() function the execution will be slow, but the onDocumentReady will not wait until the image is loaded.
Download Expert JavaScript Developer Interview Questions And Answers
PDF
Previous Question | Next Question |
What is the method for reading and writing a file in JavaScript? | Which boolean operators are in JavaScript? |