查看“︁JavaScript/call bind apply”︁的源代码
来自康健生活
←
JavaScript/call bind apply
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 引言 == == call == === 上下文 === === 继承 === == bind == === bind 实现 === <syntaxhighlight lang="javascript"> Function.prototype.bind = function(newThis) { var aArgs = Array.prototype.slice.call(arguments, 1) //拿到除了newThis之外的预置参数序列 var that = this return function() { return that.apply(newThis, aArgs.concat(Array.prototype.slice.call(arguments))) //绑定this同时将调用时传递的序列和预置序列进行合并 } }</syntaxhighlight>
返回
JavaScript/call bind apply
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。