题解 | #Function.bind#

Function.bind

https://www.nowcoder.com/practice/ecad0164931847f78c55278cee56e544

<!DOCTYPE html>
<html>
    <head>
        <meta charset=utf-8>
    </head>
    <body>
    	
        <script type="text/javascript">
            // 补全代码
            Function.prototype._bind = function(target, ...arguments1) {
                if(typeof this !== "function"){
                    throw new TypeError("Error")
                }
                const fn = this
                return function Fn(){
                    return fn.apply(
                        this instanceof Fn ? this: target,
                        arguments1
                    )
                }
            }

            
        </script>
    </body>
</html>

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务