var len = 5;var fn1 = function () { console.log(this.len); };var main = { method: function (fn) { fn(); arguments[0](); }, len : 10}; main.method(fn1);
数据分析师2017-10-01 00:27:46
JS scope problem? -PHP Chinese website Q&A-JS scope problem? -PHP Chinese website Q&A
Let’s take a look and learn.
迷茫2017-02-22 09:22:25
var fn1 = function () { console.log(this.len); };
直接执行fn1的结果是5 很显然这个函数里面的this指向的是window