Creating a Singleton

We need a global object that is always available for all the elements in an application. Let’s use a singleton, which is a design pattern that helps us create an object only one time.

  • What is a singleton
  • When do you need to use one
  • How to create a singleton in JavaScript