Last active
August 29, 2015 14:07
-
-
Save liujiangfeng/c13f1c140edfbee75179 to your computer and use it in GitHub Desktop.
bind.js
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
if( !Function.prototype.bind ){ | |
Function.prototype.bind = function( obj ){ | |
var args =[], that = this; | |
if( arguments.length > 1){ | |
args = [].slice.call(arguments , 2); | |
} | |
return function (arg){ | |
return that.apply( obj , args.cancat([].slice.call.arg)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment