Skip to content

Instantly share code, notes, and snippets.

@sunderls
Created June 1, 2020 13:15
Show Gist options
  • Save sunderls/197e5c7aa1ea4ca9b8bbd635ad06e4ba to your computer and use it in GitHub Desktop.
Save sunderls/197e5c7aa1ea4ca9b8bbd635ad06e4ba to your computer and use it in GitHub Desktop.
implement Function.prototype.call
Function.prototype.mycall = function(target, ...args) {
const key = Symbol()
target[key] = this
const result = target[key](...args)
delete target[key]
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment