From the course: JavaScript Essential Training
Unlock the full course today
Join today to access over 23,400 courses taught by industry experts.
Modern JavaScript loading - JavaScript Tutorial
From the course: JavaScript Essential Training
Modern JavaScript loading
- [Narrator] When you open an HTML document in the browser, the browser will read that document, line by line from the top down and fetch and execute any elements, it encounters as necessary. In a typical header for an HTML document, we may have references to external style sheets, and two JavaScript files. And both of these are needed for the page to render properly. So as the browser encounters these, it'll stop what it's doing, go to get the external file, then execute whatever's in that file, and then continue the rendering. When it comes to JavaScript, this can cause some significant issues. For example, we've already seen this rendering problem, where the JavaScript is referenced, and run in the browser, before the elements it's acting upon have been rendered, and therefore, we get an error in the browser. It can't do what the JavaScript is trying to do, because the elements don't yet exist. The traditional…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.