Skip to content

Instantly share code, notes, and snippets.

@shyamsalimkumar
Created February 18, 2014 18:08
Show Gist options
  • Save shyamsalimkumar/9076359 to your computer and use it in GitHub Desktop.
Save shyamsalimkumar/9076359 to your computer and use it in GitHub Desktop.
Helper method to set the value of 'this'
/**
* Helper method to set the value of 'this'.
* @param {Object} thisObject The value of 'this' to be set.
* @return {Function} Function whose this is to be set with custom this set.
*/
Function.prototype.bind = function ( thisObject ) {
var that = this;
return function () { that.apply( thisObject, arguments ); };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment