title: Good Singleton Pattern in JavaScript
body: <p>I use the following Singleton pattern in JavaScript:</p>
  
  <pre><code>  var exampleClass =(function(){ 
                          //private
                          var a ="test"; 
                          function PrivateMethod()
                          {
                              return a;
                          }
                          //public
                          return{  
                              Test: function() { 
                                     alert(PrivateMethod()); 
                                    } 
                          }
                        })(); 
  </code></pre>
  
  <p>As I read through StackOverflow I see a lot of other implementations of Singleton and I start to doubt if I couldn't make mine better.
  I hope someone can tell me what's right or wrong about doing it this way.</p>