You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>This is your battle field. you have to be rock solid in Javascript. thats what bring you the paycheck. In this section i will go through some mid to highlevel javascript interview qustions for a solid foundation... </p>
Copy file name to clipboardExpand all lines: jsQuiz.html
+10-3Lines changed: 10 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -212,8 +212,15 @@ <h2>defer vs async</h2>
212
212
<p><strong>defer</strong> defer keyword in the script tag will defer the execution of the script. Hence script will be executed when DOM is available. Important point is, defer is not supported by all major major browsers.</p>
213
213
<p><strong>async</strong> if possible, set the execution of the script, asynchronously. <code>async</code> keyword has no effect on inline script.</p>
214
214
<p> try to get some idea fromt he image copied from <ahref="http://peter.sh/experiments/asynchronous-and-deferred-javascript-execution-explained/">JS script execution</a></p>
215
-
<imgsrc="images/asyncVsDefer.jpg" alt="">
216
-
215
+
<imgsrc="images/asyncVsDefer.jpg" alt="">
216
+
</div>
217
+
<divid="onload">
218
+
<h2>window.onload vs document.onload</h2>
219
+
<p><strong>Question:</strong> What are the differences between document.onload and window.onload</p>
220
+
<p><strong>Answer:</strong><code>window.onload</code> is fired when DOM is ready and all the contents including images, css, scripts, sub-frames, etc. finished loaded.</p>
221
+
<p><code>document.onload</code> is fired when DOM (DOM tree built from markup code within the document)is ready which can be prior to images and other external content is loaded.</p>
222
+
<p><strong>bonus:</strong><code>document.readyState</code> Returns "loading" while the Document is loading, "interactive" once it is finished parsing but still loading sub-resources, and "complete" once it has loaded. The <code>readystatechange</code> event fires on the Document object when this value changes.</p>
0 commit comments