jeudi 7 janvier 2021

Does a singleton actually matter in javascript

I think that Singleton is a design pattern that mainly solves thread lock like in JAVA, Objective-C, etc.Because it can only create one object in the whole program. But JavaScript is a single thread language. Each time you export a new object that is a global object.

So my question is: Is it useful to use Singleton in JavaScript. and Why?

Aucun commentaire:

Enregistrer un commentaire