title: Method delegation to the parent in case of implementing proxies in JavaScript
body: <p>In an example from <strong>Node.js Design patterns</strong></p>
  
  <pre><code>  function createProxy(subject) {
       var proto = Object.getPrototypeOf(subject);
       function Proxy(subject) {
         this.subject = subject;
       }
       Proxy.prototype = Object.create(proto);
       //proxied method
       Proxy.prototype.hello = function() {
         return this.subject.hello() + ' world!';
       }
       //delegated method
       Proxy.prototype.goodbye = function() {
         return this.subject.goodbye
           .apply(this.subject, arguments);
  }
       return new Proxy(subject);
     }
  </code></pre>
  
  <p>What is the need for the method delegation i.e. to redefine the <strong>Proxy.prototype.goodbye</strong> method again when the method from original Object will be automatically be called as the prototype chain has been set i.e.  <strong>Proxy.prototype = Object.create(proto)</strong>. Thanks in advance. </p>