js 继承 函数
1. 为了简化类的声明 ,可以将派生子类的过程包装在名为extend的函数中;
function extend(subClass,superClass){ var F = function(){}; F.prototype = superClass.prototype; subClass.prototype = new F(); subClass.prototype.constructor = subClass; }
2. clone 函数
function(object){ function F(){}; F.prototype = object; return new F; }