小程序保持登录状态
es5实现es6的继承
classB.prototype = Object.create(ClassA.prototype);
classB.prototype.constructor = classB;
多重继承
function MyClass() {
SuperClass.call(this);
OtherSuperClass.call(this);
}
// 继承一个类
MyClass.prototype = Object.create(SuperClass.prototype);
// 混合其它
Object.assign(MyClass.prototype, OtherSuperClass.prototype);
// 重新指定constructor
MyClass.prototype.constructor = MyClass;
MyClass.prototype.myMethod = function() {...};
向my-note中javascript类,prototype,原型链专题
一章中添加这段代码