Overwrite function of existing object in javascript
<p>Consider following code:</p>

<pre><code>mynamespace.myclass = function() {
    this.myfunction = function() { alert("Original"); }
}
</code></pre>

<p>What I'm trying to do is to overwrite myfunction from outside of mynamespace.myclass declaration.</p>

<p>While adding new functions through prototype seems to work ok, if I define a function with the same name the original function doesn't get overwritten:</p>

<blockquote>
  <p>mynamespace.myclass.prototype.myfunction = function() { 
       alert("Overwritten");
    }</p>
</blockquote>

<p>Any ideas?</p>
