CHAPTER 3
Creating Reusable Code
In the introduction to the last chapter, we discussed objects as the fundamental unit of JavaScript. Having addressed JavaScript object literals, we will use a large portion of this chapter to examine how those objects interact with object-oriented programming. Here, JavaScript exists in a state of tension between classical programming and JavaScript’s own, nearly unique capabilities.
Moving outward from organizing our code into objects, we will look at other patterns for managing our code. We will want to ensure that we don’t pollute the global namespace, or (overly) rely on global variables. That means we will ...
Get Pro JavaScript Techniques, Second 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.