我现在正在学习JS,我不明白为什么‘Use Strong’指令不适用于setTimeout的回调?据我所知,对于严格的使用,它应该是未定义的,但始终具有全局对象.
function f() {
'use strict'
console.log(this === window)
}
function g() {
console.log(this === window)
}
setTimeout(g,1000) // expect true, have true
setTimeout(f,1000) // expect false, have true