2. JavaScript in the Browser

In this chapter, we lay the groundwork to help you keep proper focus as you write JavaScript on any project. Just like anything in life, as you get deeper and deeper into something, you tend to stray from the path every now and then. Knowing the core reasons for each decision you make in your code will not only help you successfully defend your choices later on, but also create the best user experience possible in writing high-performance JavaScript.

Step 1 to writing good JavaScript is getting to know your environment. Well, step 1 is really knowing JavaScript (history and so forth, but we’ll get to that shortly). As developers and designers, our environment is the browser. The browser is the crutch to our limping ...

Get Learning JavaScript: A Hands-On Guide to the Fundamentals of Modern JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.