How JavaScript Executes

By: Dusty Arlia
Published on Saturday, March 15, 2014, 07:39 PM
Last Updated on Friday, July 10, 2015 at 5:41 PM
Total Updates: 2

JavaScript is executed synchronously (or blocking) by default. What this means is that when an HTML parser comes across a <script> element, it runs the script before it can resume parsing and rendering the rest of the document. This can cause problems when that <script> element points to a large external JavaScript file (using the src HTML attribute) and the rest of the document after the script tag has to wait to render until the script is downloaded and executed.