You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionParent(){this.name='kevin';}Parent.prototype.getName=function(){console.log(this.name);}functionChild(){}Child.prototype=newParent();varchild1=newChild();console.log(child1.getName())// kevin
1、原型链继承
缺点:
2、构造函数继承(经典继承)
缺点:
3、组合继承
缺点:
4、寄生组合式继承
5、类继承
总结
1、函数声明和类声明的区别
函数声明会提升,类声明不会。首先需要声明你的类,然后访问它,否则会抛出一个ReferenceError
2、ES5继承和ES6类继承的区别
The text was updated successfully, but these errors were encountered: