Skip to content

Topics

Jump to a topic.

Search questions

Find a question by title, tag, or summary.

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.
  1. 010What is the module pattern, and what did ES modules take over from it?easy
  2. 020Implement an event emitter. How does observer differ from publish/subscribe?Coremedium
  3. 030How do you make a singleton in JavaScript, and when is one a mistake?medium
  4. 040Factory functions vs classes: when do you pick which?medium