title: Is it possible to add some code to existing javascript functions without modify original code?
body: <p>There is some javascript code, e.g.</p>
  
  <pre><code>function hello() {
  }
  function world() {
  }
  </code></pre>
  
  <p>I want to add some logging code to them, but I don't want to modify the code. I hope I can write some code in another file, and it will modify the functions at runtime. It is possible to do this?</p>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>Thanks for the two answers, but I have to make this question clearer. </p>
  
  <p>The <code>hello</code> and <code>world</code> functions are just some samples, actually there are hundreds of functions in the file, it's implement to redefine them manually.</p>
  
  <p>I'm looking for a way to do this automatically (similar to AspectJ in java).</p>