Design Patterns · Junior · Question 3 of 75

What does the Singleton pattern guarantee?

Explanation

Examples: one API client, one logger, one DB connection. In JS, the simplest singleton is a module: export const api = new ApiClient() - a module runs once, and all importers get the same object.

Further reading

Problem with a question

Design Patterns · Junior · question 3

Test yourself

Take the Design Patterns · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz