<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>构造函数内部的this</title></head><body><script>functionPerson(){
console.log("Person构造函数",this);functionpersonInner(){//这个this始终是window
console.log("personInner构造函数",this);}personInner();}let p =newPerson();//此时this是创建的Person实例Person();//此时this代指window对象classStudent{constructor(){
console.log("Student构造函数",this);}}let s =newStudent();//下面这种写法不符合语法规范,将会报错Student();</script></body></html>