title: Iterate and change javascript functions on-the-fly
body: <p>I want to be able to iterate through all JavaScript functions in my document and, for instance, add an <code>alert('ok');</code> to them.</p>
  
  <p>so if I have:</p>
  
  <pre><code>function a(num) {
    return num;
  }
  </code></pre>
  
  <p>after I run my javascript code and call this function, it will actually do:</p>
  
  <pre><code>{
    alert('ok');
    return num;
  }
  </code></pre>
  
  <p>I know I can access a function using window.[funcName], but how can I iterate thru all functions and edit them?</p>
  
  <p>thanks</p>
  
  <p>PS: I know this is not a very good idea, but it's just for a debug environment</p>