Last active
November 24, 2021 14:29
-
-
Save rahgurung/90af852f42fab51f8a6a858d65b8ac2a to your computer and use it in GitHub Desktop.
This file contains 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
function increase() { | |
// increment each time | |
this.x++; | |
} | |
// Create a property to the function object | |
increase.x = 0; | |
// Call function few times with using itself as `this` | |
increase.call(increase); | |
increase.call(increase); | |
console.log(increase.x); // 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment