Answers for "polyfill for apply"

0

polyfill for apply

Function.prototype.myCall = function (...args) {
  let obj = args[0]
  const params = args.slice(1)

  obj = {
    ...obj,
    fn: this
  }

  return obj.fn(params)
}
Posted by: Guest on May-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language