function foo () {
setTimeout(function () { console.log(this);
})
};
foo();這段在html中執行this就會window,這個非常容易理解,但是為什么在repl node執行環境setTimeout中的this不是指向globel,而是指向了setTimeout這個函數呢?
nodejs中函數this問題
DIEA
2018-09-06 14:14:33