Question · JavaScript and TypeScript course · Module 9: Design Patterns and Architecture

Factory Pattern

When is it worth using the Factory pattern?

Answer options

  • When object creation is complex and we want to separate creation logic from usage
  • When we need exactly one instance of an object
  • When we want to restrict access to an object's methods
  • When we want to add new functionality to an existing object

You can check the correct answer by solving this task in the CodeWorlds game.