---
title: "Comment by Tony B on \"Singleton Pattern in Javascript\" | Hashnode"
description: "Although there are a lot of good uses for Singletons, this example is a little ironic. The use of a Module means there is only one instance of the Singleton con"
url: "https://hashnode.com/posts/singleton-pattern-in-javascript/608d4c86a3716542f363f123/comment/608d8459a3716542f363f46c"
---

[Discussion](https://hashnode.com/posts/singleton-pattern-in-javascript/608d4c86a3716542f363f123)

Comment [Singleton Pattern in Javascript](https://hashnode.com/posts/singleton-pattern-in-javascript/608d4c86a3716542f363f123)

[Tony B](https://hashnode.com/@octree)

[May 1, 2021](https://hashnode.com/posts/singleton-pattern-in-javascript/608d4c86a3716542f363f123/comment/608d8459a3716542f363f46c)

Although there are a lot of good uses for Singletons, this example is a little ironic. The use of a Module means there is only one instance of the Singleton constant, so the entire class is unnecessary. In rare cases where complex dependencies and versions create multiple instances of a module, your example wouldn't work anyway as there would be multiple instances.

i.e. just use **const Singleton = new Username()** in your module and move on :)

[Bibek Kakati](https://hashnode.com/@bibekkakati)

[May 1, 2021](https://hashnode.com/posts/singleton-pattern-in-javascript/608d4c86a3716542f363f123/comment/608d8459a3716542f363f46c#reply-608d8bd5a3716542f363f4c4)

Hey Tony, you are right we can use the Singleton constant directly and this is just a basic example to show the use case. And I always prefer to follow the common implementation way of these design patterns. We can use the same pattern inside class-based Singleton too. At last, we have two choices in javascript, either modularisation approach or singleton approach.
