Skip to content

Instantly share code, notes, and snippets.

@sharmaabhinav
Created November 5, 2017 13:16
Show Gist options
  • Save sharmaabhinav/784799928bce957a00c8357b1b0c9526 to your computer and use it in GitHub Desktop.
Save sharmaabhinav/784799928bce957a00c8357b1b0c9526 to your computer and use it in GitHub Desktop.
var Something = {
cool: function() {
this.greeting = "Hello World";
this.count = this.count ? this.count + 1 : 1;
}
};
Something.cool();
console.log(Something.greeting)
console.log(Something.count);
var AnotherObj = {
cool: function () {
Something.cool.call(this)
}
}
AnotherObj.cool()
console.log(Something, AnotherObj)
AnotherObj.count = 5
console.log(Something, AnotherObj)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment