JSFiddle - React, Tailwind, and code Playground
by Artem
JavaScript
'use strict';
/* function Singleton() {
if (Singleton.prototype.getInstance === undefined) {
Singleton.prototype.getInstance = () => this;
}
return Singleton.prototype.getInstance();
}
var s1 = new Singleton();
var s2 = new Singleton();
console.log(s1 === s2); */
const Singleton = new function() {
console.log(this);
const single = this;
// return function() { console.log('inner', this); return single };
};
console.log(Singleton);
/* var s = new Singleton();
console.log(s); */