const obj = {
length:10,
log() {
console.log(this.length)
}
}
obj.log() // 10
const length = 20
const fn = obj.log
fn() // 0
const arr = [30,obj.log]
arr[1]() // 2
Why the fn() result is 0 ? if use var length = 20 instead of const length = 20 the result is 20, how this happening?