Skip to content
JavaScript·Intermediate·Conceptual·1 min read

What does the factory pattern centralize that a set of scattered constructor calls doesn't?

Short interview answer

The decision logic for exactly what gets created and how, in one place — so that logic can vary based on configuration or runtime conditions without every call site needing to know or duplicate that decision.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to JavaScript design patterns

Related questions