SOURCE

// bind
Function.prototype.myBind = function (context) {
  let self = this
  const fBound = function () {
    return self.apply(
    	this instanceOf self ? this: context,
      Array.from(arguments)
    )
  }
  
  if (this.prototype) {
    fBound.prototype = Object.create(this.prototype)
  }
  
  return fBound
}

// call
Function.prototype.myCall = function () {
	const [context, ...args] = arguments
  const func = Symbol()
  context[func] = this
  return context[func](...args)
}

// apply
Function.prototype.myApply = function () {
	const [context, ...args] = arguments
  const func = Symbol()
  context[func] = this
  return context[func](args)
}
console 命令行工具 X clear

                    
>
console