JavaScript 严格模式和this

严格模式下,匿名函数内部的 this 不再是 window,而是undefined

        "use strict";

        (function(){
            console.log(this);
        })();

输出 undefined

使用 bind 方法修正

        "use strict";        

        (function(){
            console.log(this);
        }).bind(window)();        

输出 window

原文地址:https://www.cnblogs.com/chenyingzuo/p/12379967.html