SOURCE


Function.prototype.myBind = (context) {
    const self = this;
    const args = Array.prototype.slice.call(arguments, 1);

    return function() {
        const innerArgs = Array.prototype.slice.call(arguments, 0);

        return self.apply(context, [...args, ...innerArgs]);
  
  }
}

function lickNew() {
    const obj = {};

    const constructor = [].shift.call(arguments);
    obj.__proto__ = constructor.prototype;

    // 构造函数继承
    constructor.call(obj, arguments);

    return obj;
}
console 命令行工具 X clear

                    
>
console