Last active
August 14, 2016 21:03
-
-
Save saltukalakus/6eca891a1222708e4508502692cde5fc to your computer and use it in GitHub Desktop.
js bind
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
var person = { | |
name: "James Smith", | |
hello: function(thing) { | |
console.log(this.name + " says hello " + thing); | |
} | |
} | |
var helloFunc = person.hello.bind(person); | |
helloFunc("world"); // output: "James Smith says hello world" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment