title: How to store variables: Privileged method, static property
body: <p>Instead of just saying:</p>
  
  <pre><code>var thing = timeConsumingMethod();
  </code></pre>
  
  <p>I have my variable hidden in a method like so:</p>
  
  <pre><code>function _thing() {
      var thing = timeConsumingMethod() );
      return thing;
      }
  </code></pre>
  
  <p>It gets called a number of times. I'm concerned that I'm made things very inefficient. I assume it calls timeConsumingMethod every time (which is unneeded, it's always the same) I call "_thing()" to get my variable.</p>
  
  <p>How do I manage these types of variables in simple efficient way? Is something like this a solution?:</p>
  
  <pre><code>function _thing() {
      return _thing.thing 
      }
      _thing.thing = timeConsumingMethod();
  </code></pre>
  
  <p>Basically, i want the protection of a function and to (ideally0 access my variable using _thing() or something similar, but I only want timeConsumingMethod to run once.</p>
  
  <p>edit: tried this, doesn't work either:</p>
  
  <pre><code>function _thingy() { 
  var thing = timeConsumingMethod();
  }
  _thingy.test = function() {
  return( _thingy.thing)
  }
  </code></pre>