Created
August 19, 2012 03:41
-
-
Save partynight12th/3391670 to your computer and use it in GitHub Desktop.
Function.prototype.bind at JavaScript for MobileSafari
This file contains 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.hasOwnProperty("bind")){ | |
Function.prototype.bind = function(){ | |
var func = this; | |
var t = arguments[0]; | |
var len = arguments.length; | |
var newargary = []; | |
for(var i = 1; i < len; i++){ | |
newargary.push(arguments[i]); | |
} | |
return function(){ | |
return func.apply(t, newargary); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment