javascript inheritance pattern confusion
<p>I find this is most recommended  way to do inheritance in javascript.</p>

<pre><code>function extend(Child, Parent) {
 var F = function(){};
 F.prototype = Parent.prototype;
 Child.prototype = new F();
}
</code></pre>

<p>what if I already have methods in child's prototype, aren't they will overwrite, shouldn't we preserve them.</p>

<pre><code>function extend(Child, Parent) {
 var c = child.prototype;
 var oldProto = new C();  
 var F = function(){};
 F.prototype = Parent.prototype;
 Child.prototype = new F();
 for(var i in oldProto ){
   Child.prototype[i] = oldProto[i]  
 }  
}
</code></pre>
