function User(name){ this.name=name; this.show=function(){ console.log(this); } } let xj=new User("xj"); xj.show();//对象去调用的时候this指向当前对象 User {name: 'xj', show: ƒ} //如果是当作普通函数调用,this指向是window let xj1=xj.show; xj1();//Window {window: Window, self: Window, document: document, name: '', location: Location, …}
// 严格模式下,this是undefined
//可以看this指向那一章