Created
December 29, 2020 03:21
-
-
Save phobal/9f02a9554c8115abcd27657efbb700b0 to your computer and use it in GitHub Desktop.
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
| const a = { | |
| a: 'a' | |
| }; | |
| const obj = { | |
| getThis: () => this, | |
| getThis2 () { | |
| return this; | |
| } | |
| }; | |
| obj.getThis3 = obj.getThis.bind(obj); | |
| obj.getThis4 = obj.getThis2.bind(obj); | |
| const answers = [ | |
| obj.getThis(), | |
| obj.getThis.call(a), | |
| obj.getThis2(), | |
| obj.getThis2.call(a), | |
| obj.getThis3(), | |
| obj.getThis3.call(a), | |
| obj.getThis4(), | |
| obj.getThis4.call(a) | |
| ]; | |
| console.log(answers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment