SOURCE

Function.prototype.bind = function(context, ...rest) {
    const fn = this;
    return function() {
        fn.apply(context, rest);
    };
};

const me = { name: 'Jack' }
const other = { name: 'Jackson' }
function say() {
  console.log(`My name is ${this.name || 'default'}`);
}
const meSay = say.bind(me)
meSay()
const otherSay = say.bind(other)
otherSay()
console 命令行工具 X clear

                    
>
console