title: javascript inheritance with protected variables
body: <p>Is it possible in javascript to have a variable that is not able to access out side the class's functions, but is able to be accessed by classes that inherit it? I.E:</p>
  
  <pre><code>class1 has protected var x = 4;
  
  class2 inherits class1;
  
  class2.prototype.getVar = function(){return /* parent, uber, super, whatever */ this.x;};
  
  var cl2 = new class2();
  
  console.log(cl2.x) // undefined
  console.log(cl2.getVar()) // 4
  </code></pre>