Last active
November 5, 2017 02:20
-
-
Save DmitrySoshnikov/61a97a6c56afc8a83e833e95b2b1cc8c 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
/** | |
* JavaScript dynamic `this` value. | |
*/ | |
function produce() { | |
console.log(this.x); | |
} | |
const alpha = {produce, x: 1}; | |
const beta = {produce, x: 2}; | |
const gamma = {produce, x: 3}; | |
console.log( | |
alpha.produce(), // 1 | |
beta.produce(), // 2 | |
gamma.produce(), // 3 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment