<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var fn1=function(a,b,c){
            console.log('this',this);
            console.log(...arguments);
            return '123ere'
        }
        Function.prototype.bind1=function(){
            var args=Array.from(arguments);
            // var args=Array.prototype.slice.call(arguments);
            var a=args.shift();
            const fn=this;
            return function(){
                var args1=Array.from(arguments);
                var c=args.concat(args1);
                return fn.apply(a,c);
            };
        };
        var fn2=fn1.bind1({x:100},13,23,34);
        var result=fn2(4,5);
        console.log(result);
        
        
    </script>
</body>
</html>

kangting
62 声望3 粉丝

一只小小的前端