Skip to content

Instantly share code, notes, and snippets.

@wjx0912
Created Jul 26, 2022
Embed
What would you like to do?
js_question
var name = 'window'
var person1 = {
name: 'person1',
foo1: function () {
console.log(this.name)
},
foo2: () => console.log(this.name),
foo3: function () {
return function () {
console.log(this.name)
}
},
foo4: function () {
return () => {
console.log(this.name)
}
}
}
var person2 = { name: 'person2' }
person1.foo4.call(person2)() // 为什么输出的是'person2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment