Skip to content

Instantly share code, notes, and snippets.

@rahgurung
Last active November 23, 2021 16:38
Show Gist options
  • Save rahgurung/33f707ee7824e63590b795dd36cd647b to your computer and use it in GitHub Desktop.
Save rahgurung/33f707ee7824e63590b795dd36cd647b to your computer and use it in GitHub Desktop.
function doSomething() {
console.log( this.x );
}
// This is the context object
var obj = {
x: "Hello World!",
y: doSomething
}
obj.y(); // "Hello World!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment