Chapter 18. JavaScript in the Browser

JavaScript began its life as a browser scripting language, and now holds a near-complete monopoly in that role. This chapter is for anyone who’s working with JavaScript in the browser. The language may be the same, but there are some special considerations and APIs for this scenario.

Fully covering browser-based JavaScript development is a whole book in itself. The goal of this chapter is to introduce you to the important core concepts in browser development, which will give you a solid foundation. At the end of this chapter, I will recommend some additional learning resources.

In Chapter 2, I recommended that if you are doing browser development, you use a front-end library such as React, Angular, or Vue. In addition to providing a lot of out-of-the-box functionality, these frameworks will help with packaging, including transcompiling your code to increase browser compatibility and performance. However, even if you are using a framework, it’s helpful to know some background about how browsers work: it will give you insight into your chosen framework, and increase your ability to diagnose problems. In other words, this chapter is designed to provide important fundamentals, but I encourage you to think carefully before you use this information to build a real web application from scratch!

Note

Previous versions of this book included a chapter on jQuery, a once-popular browser library. The general consensus in the development community ...

Get Learning JavaScript, 3rd Edition 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.