手写bind函数

Function.prototype.bind1 = function () {
        // const args = Array.from(arguments);
        const args = Array.prototype.slice.call(arguments);
        const target = args.shift();
        const self = this;
        return  function () {
            const newArgs = Array.from(arguments);
            return self.apply(target, [...args, ...newArgs])
        }
}
原文地址:https://www.cnblogs.com/Mr-Rshare/p/15072800.html