function Mother(lastName) {
this.lastName = lastName
}
let son = new Mother('技术蛋老师')
1.创建一个新对象son
2.新对象会被[[prototype]]原型对象连接起来
son.__proto__ === Mother.prototype // true
3.新对象和函数调用的this会绑定起来
Mother.call(son, '技术蛋老师')
4.执行构造函数中的代码
son.lastName
5.如果函数没有返回值,那么就会自动返回这个新对象
网友评论