JSFiddle - React, Tailwind, and code Playground
by Anurag Udasi
JavaScript
var singleton = (function()
{
var instance;
return function()
{
if(typeof instance == "undefined")
{
instance = new Object();
alert('hi');
}
return instance;
};
})();
alert(singleton());
alert(singleton());