console.log(this === window); //true var yanzheng = ()=>{ if(window === this){ console.log("全局环境下,this就是指顶层的window"); }else{ alert("错误"); } } yanzheng(); //全局环境下,this就是指顶层的window\ 复制代码