Skip to content

Instantly share code, notes, and snippets.

@icodesido
Created November 28, 2013 17:41
Show Gist options
  • Save icodesido/7695688 to your computer and use it in GitHub Desktop.
Save icodesido/7695688 to your computer and use it in GitHub Desktop.
native js vs underscore
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