title: Does JavaScript have an equivalent way to implement c# style auto properties without massive overhead?
body: <p>I'm curious if JavaScript has a way to bind a function when a property is changed without an enormous overhead like watching all the auto-properties with a timer, but without setting them via a function call.  For example, I know you could do something like:</p>
  
  <pre><code>var c = new (function () {
      this.Prop = 'test';
      this.Prop_get = function (value) {
          return('Prop = ' + this.Prop);
      };
      this.Prop_set = function (value) {
          if (value != 'no') {
              this.Prop = value;
          }
      };
  })();
  
  document.write(c.Prop_get());
  document.write('&lt;BR /&gt;');
  c.Prop_set('no');
  document.write(c.Prop_get());
  document.write('&lt;BR /&gt;');
  c.Prop_set('yes');
  document.write(c.Prop_get());
  document.write('&lt;BR /&gt;');
  </code></pre>
  
  <p>But I'm looking for some way to allow the following to produce the same result:</p>
  
  <pre><code>document.write(c.Prop);
  document.write('&lt;BR /&gt;');
  c.Prop = 'no';
  document.write(c.Prop);
  document.write('&lt;BR /&gt;');
  c.Prop = 'yes';
  document.write(c.Prop);
  document.write('&lt;BR /&gt;');
  </code></pre>
  
  <p>With any changes to the pseudoclass other than adding a timer to watch the Prop property for changes or similarly high-overhead solutions.</p>