title: Encapsulating in JavaScript, does it exist?
body: <p>I have an experience with the C# programming language, but I also have to work with the JS now and it's rather new for me.</p>
  
  <p>I have tried to develop a simple class emulation in JS, like this:</p>
  
  <p><a href="http://jsfiddle.net/T74Zm/" rel="nofollow">http://jsfiddle.net/T74Zm/</a></p>
  
  <pre><code>function A( inputValue ) {
      this.Init( inputValue );
      this.Print();
  }
  A.prototype = {
      value: null,
      Init: function( inputValue ) {
          this.value = inputValue;
      },
      Print: function () {
          console.log( this.value );
      }
  }
  
  var obj = new A(40);
  </code></pre>
  
  <p>I've tried to encapsulate the variable <code>value</code> in <code>A.prototype</code>, but it seems to be by JavaScript specification that all objects are available.</p>
  
  <p>So my questions are:</p>
  
  <p>1). How can I make an encapsulation , which is very close to the static languages with OOP/access modifiers support?</p>
  
  <p>2). How can I emulate some access modifiers in JS, like <code>private</code> for e.g.?</p>