How to redefine JS function keeping previous in chain
<p>This is common task coming from object oriented programming, I would like to change behavior of JavaScript program by overriding existing function with possible calling it as well. I remember Windows introduced that as writing hooks and chaining them. So what I want, I have a web page which calls some onload hook which finally calls function initFields. I want to redefine this function however keep previous implementation. If I simply define my JS function as </p>

<pre><code>function initFields() {
  // do some stuff ...
   // I do not know how to call super.initFields() here
}
</code></pre>

<p>I read something like you can write</p>

<pre><code>initFields.prototype = function() {
     // do some stuff ...
     // but still have no idea how to call the original one
 };
</code></pre>

<p>Can somebody help?</p>
