Skip to content

Instantly share code, notes, and snippets.

@bitfishxyz
Created February 7, 2019 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitfishxyz/fac4e911c99761b2f357fb3788e261dc to your computer and use it in GitHub Desktop.
Save bitfishxyz/fac4e911c99761b2f357fb3788e261dc to your computer and use it in GitHub Desktop.
Imitation of Function.prototype.call
Function.prototype.myCall = function(thisArgs) {
thisArgs.$fn = this //
let args = []
for(let i = 1; i<arguments.length; i++){
args.push(arguments[i])
}
var result = thisArgs.$fn(...args)
delete thisArgs.$fn
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment