Put in order · JavaScript and TypeScript course · Module 9: Design Patterns and Architecture
Stages of Singleton Pattern Implementation
Arrange the stages of Singleton pattern implementation:
Items to put in order
- Declare a static instance field
- If not - create a new one and save it in instance
- Check in the constructor whether instance already exists
- If it exists - return the existing object
You can check the correct answer by solving this task in the CodeWorlds game.