Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

polyfill for bind

Function.prototype.myBind = function (...args) {
  const that = this
  const params = args.slice(1)
  return function (...args2) {
    that.apply(args[0], [...params, ...args2])
  }
}
 
PREVIOUS NEXT
Tagged: #polyfill #bind
ADD COMMENT
Topic
Name
3+3 =