//不使用new指向windowfunction Person (name) {
console.log(this) //windowthis.name = name;
}
Person('inwe')
//使用newfunction Person (name) {
this.name = name
console.log(this) //people
self = this
}
var people = new Person('iwen')
console.log(self === people) //true//这里new改变了this指向,将this由window指向Person的实例对象people