examples/js/Object.prototype.watch.js
function (newValue) {
                    // and no inheritance is involved
                    if (this === self) {
                      // notify the method but ...
                      var value = oldValue;
                      updateValue(newValue);
                      // ... do not update the get value
                      oldValue = value;
                    } else {
                      // with inheritance, simply set the property
                      // as if it was a regular assignment operation
                      setValue(this, prop, newValue);
                    }
                  }
function (newValue) {
                    // and no inheritance is involved
                    if (this === self) {
                      // notify the method but ...
                      var value = oldValue;
                      updateValue(newValue);
                      // ... do not update the get value
                      oldValue = value;
                    } else {
                      // with inheritance, simply set the property
                      // as if it was a regular assignment operation
                      setValue(this, prop, newValue);
                    }
                  }
function ( newValue ) { // and no inheritance is involved if ( this === self ) { // notify the method but ... var value = oldValue ; updateValue ( newValue ) ; // ... do not update the get value oldValue = value ; } else { // with inheritance, simply set the property // as if it was a regular assignment operation setValue ( this , prop , newValue ) ; } }
if not writable ...
if not writable ...