摘要:
原文链接:http://js8.in/698.html.构造函数继承:第一种方法是使用prototype属性:这里也可以直接Child.prototype=new P();考虑到P构造函数的参数无法确定,所以使用一个空函数。function extend(Child,Parent){ var F=function(){}; F.prototype=Parent.prototype; Child.prototype=new F(); Child.prototype.constructor=Child;}第二种方法则是属性和方法的拷贝:function extend(Chi... 阅读全文