【对象&实例】
封装数据/方法
1 | //构造函数 |
创建实例
1 | //实例化两个对象 |
【构造函数的继承】
现在有两个构造函数1
2
3
4
5
6
7
8
9
10
11
12function Me1(){
this.name = 'xkh'
}
function Me2(age, height){
Me1.apply(this, arguments);
this.age = age,
this.height = height
}
var m3 = new Me2();
console.log(m3.name)