JavaScript Design Patterns

Review your understanding of common design patterns used in JS/TS.

1. Which design pattern ensures a class has only one instance and provides a global point of access to it?
2. Which pattern creates objects without specifying the exact class to instantiate?
3. Which pattern encapsulates code by using closures to create private and public members?
4. Which pattern defines a one-to-many dependency between objects so that when one object changes state, all dependents are notified?
5. Which pattern uses a constructor function with the 'new' keyword to initialize objects with shared properties?
6. Which pattern leverages the prototype chain to share methods among instances, reducing memory usage?
7. Which pattern dynamically adds or overrides behavior of an object at runtime without modifying its class?
8. Which pattern enables selecting an algorithm's implementation at runtime by encapsulating each algorithm?
9. Select all creational design patterns from the following:
10. Which patterns promote loose coupling between components?
11. Which patterns are used to dynamically add functionality to objects?
12. Identify all structural design patterns:
13. Which patterns involve a 'subject' that notifies other objects of state changes?
14. The Singleton pattern is thread-safe by default in JavaScript.
15. The Module pattern typically uses IIFEs (Immediately Invoked Function Expressions) to create private scope.
16. JavaScript's inheritance model is based on the Prototype pattern.
17. The Observer pattern is identical to the Publish-Subscribe pattern.
18. What design pattern is characterized by objects (observers) registering to receive updates from a central object (subject)?
19. Name the structural pattern that provides a simplified interface to a complex subsystem (full name or common abbreviation).
20. What pattern uses closures to create private variables and expose public methods that can access them?
Answered 0 of 0 — 0 correct