Chapter 28
Design patterns
The classic patterns as JavaScript actually expresses them: closures and modules instead of access modifiers, functions instead of factory classes, and events instead of hand-rolled callbacks.- 010What is the module pattern, and what did ES modules take over from it?easy
- 020Implement an event emitter. How does observer differ from publish/subscribe?Coremedium
- 030How do you make a singleton in JavaScript, and when is one a mistake?medium
- 040Factory functions vs classes: when do you pick which?medium