SOURCE

Function.prototype.mycall = function (context) {
  if (typeof context === 'object') {
    context = context || window;
  } else {
    context = Object.create(null)
  }
  context.fn = this
  let args = []
  for (let i = 1, len = arguments.length; i < len; i++) {
    args.push('arguments[' + i + ']')
  }
  let result = eval('context.fn(' + args + ')')
  delete context.fn
  return result
}
console 命令行工具 X clear

                    
>
console