title: How to share variables between classes in javascript
body: <p>I am expanding my JS knowledge by building custom libraries on-top of jQuery/JS and the classes have to interact between each other. I am coming from PHP, so there I could use static variables, but have no idea in JS. Here is an example of what I want:</p>
  
  <pre><code>var A = function() {
      this.myPublicVar = "thisShouldBePrintedFromClassB";
  }
  
  A.prototype = {
      showMyVar : function() {alert(this.myPublicVar);} // This gets triggered on direct access.
  }
  
  var B = function() {}
  B.prototype = {
      // I have no idea how to to access A.myPublicVar
  }
  </code></pre>
  
  <p>Anyone could provide me with simple tutorial or anything?</p>
  
  <p>PS: I have just started to expand my JS knowledge, have used JS/jQuery for easy design purposes (using selectors and building data validators and etc.)</p>