Chapter 4: JavaScript Design Patterns: The Singleton
by Samier Saeed
In this chapter, we’ll dig into the best way to implement a singleton in JavaScript, looking at how this has evolved with the rise of ES6.
Among languages used in widespread production, JavaScript is by far the most quickly evolving, looking less like its earliest iterations and more like Python, with every new spec put forth by ECMA International. While the changes have their fair share of detractors, the new JavaScript does succeed in making code easier to read and reason about, easier to write in a way that adheres to software engineering best practices (particularly the concepts of modularity and SOLID principles), and easier to assemble into canonical software design patterns. ...
Get JavaScript: Best Practice 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.