this strict mode

在严格模式下,this将保持他进入执行环境时的值:
function mf(){
"use strict"; // this is a strict mode 
  return  the this ; 
} 
F () === undefined; // to true 
window.mf () === window; // to true
在严格模式下,如果 this 没有被执行环境定义,那它将保持为 undefined
因为f是被直接调用的,而不是作为对象的属性或方法调用的(如 window.mf()此时返回window)。
有一些浏览器最初在支持严格模式时没有正确实现这个功能,于是它们错误地返回了window对象。

Guess you like

Origin www.cnblogs.com/xinyouhunran/p/12132596.html