Use _.bind() for simple callbacks.
Need to create a callback that simply calls another function?
var callback = function() {
return model.get('comment');
}
The following code gives you the same result:
var callback = _.bind(model.get, model, 'comment'),
Written by Asa Ayers
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Underscorejs
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#