A browser builds a page by parsing HTML and building the DOM, then executing JavaScript. Encountering a script element—containing or referring to JavaScript—triggers execution; the browser can alternate between these steps as needed. section 2.2
Figure 2.3. The page-building phase starts when the browser receives the code of the page. It’s performed in two steps: parsing the HTML and building the DOM, and executing JavaScript code.
Trace how HTML parsing and DOM construction alternate with JavaScript execution during page building. section 2.2


