Singleton Design Pattern in JavaScript
Medium
4
72.7% Acceptance
In this lab, you will learn and implement the Singleton design pattern in JavaScript. A Singleton is a creational design pattern that ensures that a class has only one instance and provides a global point of access to it. Use ES6 class syntax to create the Singleton class.
Your task is to create a Singleton
class with a getInstance
method, ensure that only one instance of the class is created, and provide a method named message
that returns 'Hello Singleton!' when called.