Singletons in JavaScript
How to implement them and whether they’re actually useful
4 min readJul 26, 2020
A singleton is a function or class which can have only one instance. It’s a design pattern popularised by the “Gang of Four” in their influential Design Patterns. However, the singleton is one of several patterns in the book which have been criticised. Some are regarded as anti-patterns, while others are only useful in…