title: Limiting access to JavaScript variables
body: <p>I'm modifying a module for a game that we are developing and it is built with ImpactJS game engine. What we wanted to do is to make the variables private or inaccessible to other classes.</p>
  
  <p>For example:</p>
  
  <pre><code>this.object.variable = 100; // Not okay.
  this.object.setVariable( 100 ); // Okay.
  
  ig.module( 
      'game.data.server' 
  ).requires(
  
  ).defines(function(){
  
      ServerData = ig.class.Extend({
          _variable : -1,
  
          get variable() {
              return this._variable ;
          },
          setVariable: function( value ) {
              this._variable = value;
          }
      });
  });
  </code></pre>
  
  <p>But <a href="https://stackoverflow.com/questions/23515188/javascript-setter-and-getter-return-different-outputs/23518485?noredirect=1#23518485">JavaScript setter and getter return different outputs</a></p>
  
  <p>We can't do several revisions because this is also accessed by other games that we are developing.</p>
  
  <p>Is there a better solution?</p>