← Back to Roadmap

Design Patterns

Hard

In plain terms

Common patterns: Singleton, Factory, Observer, Module, Decorator. Reusable solutions to recurring problems. JavaScript supports many patterns natively.

What you need to know

  • •Singleton, Factory, Observer
  • •Module pattern
  • •Patterns as solutions

Try it yourself

Copy the code below and run it in your browser console or a code editor:

const singleton = (() => { let instance; return { getInstance: () => instance || (instance = {}); }; })();

Learn more

Dive deeper with these trusted resources: