构造函数的继承
在将继承之前先说一下ES5和ES6的构造函数语法ES5的构造函数语法function CreateObj1(name,age){ this.name = name; this.age = age;}createObj1.prototype.fun = function(){ console.log('我是ES5语法创建的实例化对象')}ES6的构造函数语法class CreateObj2{ constructor(name,age){ this
原创
2020-08-07 21:24:56 ·
983 阅读 ·
0 评论