Created
July 26, 2022 14:41
-
-
Save wjx0912/d35334195ca92d25940086ba533e652d to your computer and use it in GitHub Desktop.
js_question
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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