Skip to content

Instantly share code, notes, and snippets.

@JunPyoL22
Created March 17, 2018 14:25
Show Gist options
  • Save JunPyoL22/d32ebe17602f3ef3917552862d57c93f to your computer and use it in GitHub Desktop.
Save JunPyoL22/d32ebe17602f3ef3917552862d57c93f to your computer and use it in GitHub Desktop.
var obj = {
x:10,
printX:function(){
console.log(this.x);
}
}
var printx1 = obj.printX;
printx1() // => undefined
var printx2 = printx1.bind(obj)
printx2() // => 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment