Created
November 28, 2013 17:41
-
-
Save icodesido/7695688 to your computer and use it in GitHub Desktop.
native js vs underscore
This file contains hidden or 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 Developer(skill) { | |
| this.skill = skill; | |
| this.says = function(){ | |
| alert(this.skill + ' rocks!'); | |
| } | |
| } | |
| var john = new Developer('Backbone'); | |
| var func = john.says; | |
| func.apply(john); | |
| var john = new Developer('Backbone'); | |
| var func = _.bind(john.says, john); | |
| func(); | |
| var john = new Developer('Backbone'); | |
| _.bindAll(john, 'says'); | |
| var func = john.says; | |
| func(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment