title: Defining object of function prototype
body: <p>I am trying to override a function of a object. </p>
  
  <p>Have a look at this code:</p>
  
  <pre><code>var renderer = function(options) {
  
      this.options = options || {};
  }
  
  
  renderer.prototype.init = function() {
  
      if(this.options.make) {
  
          console.log('making ....');
      }
  }
  </code></pre>
  
  <p>Now, my application code is :</p>
  
  <pre><code> var myRendering = new renderer({make: true});
  
   var oldInit = myRendering.init;
   myRendering.init = function() {
  
      console.log('pre make stuff here');
  
      oldInit();
   }
  </code></pre>
  
  <p>Now, if i call</p>
  
  <pre><code>myRendering.init();
  </code></pre>
  
  <p>I get, </p>
  
  <pre><code>TypeError: Cannot read property 'make' of undefined
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>pre make stuff here    
  making ....
  </code></pre>
  
  <p>I know, i can do it this way :</p>
  
  <pre><code> var myRendering = new renderer({make: true});
  
   var oldRendering = new renderer({make: true});
   myRendering.init = function() {
  
      console.log('pre make stuff here');
  
      oldRendering.init();
   }
  </code></pre>
  
  <p>But is there any other way to define the options object in my <strong>application code</strong> without
  creating an another copy of the object ?</p>