title: class declared inside closure vs standard class without closure
body: <p>Normally I use standard OOP approach based on prototype and my class looks like this</p>
  
  <pre><code>var std = function(){
     this.log = function(msg){ console.log("want to be private. " + msg) };
  };
  
  std.prototype = {
      logInfo: function(msg){
          this.log(msg);
      }
  };
  </code></pre>
  
  <p>but in that case <code>log</code> is public method and anyone could use it. But I want to make it private, but still available in methods declared in prototype. For that we will need closures. Code will change to this</p>
  
  <pre><code>var closureStd = (function(){
  var std = function(){};
  var log = function(msg){ console.log("I'm really private, youhooo!" + msg) };
  
  std.prototype = {
      logInfo: function(msg){
          log(msg);
      }
  };
  
  return std;
  })();
  </code></pre>
  
  <p>So my question: what is the difference between <code>std</code> and <code>closureStd</code> and what is the price I need to pay to be able to call private methods from prototype?</p>