1.

call()、bind()、apply()的用法,改变this的指向,区别在于
f.call(obj, arg1, arg2...),
f.bind(obj, arg1, arg2,...)(),
f.apply(obj, [arg1, arg2, .])

Example:封装函数 f,使 f 的 this 指向指定的对象

(1)apply()

function bindThis(f, oTarget) {
return function() {
return f.apply(oTarget, arguments)
}
}

(2)bind()

function bindThis(f, oTarget) {
return f.bind(oTarget)
}

(3)call()

function bindThis(f, oTarget) {
return function() {
return f.call(oTarget, ...arguments)
}
}

最新文章

  1. Linq 单表城市级联
  2. 乌邦图ubuntu配置iptables的NAT上网
  3. 清除Windows的DNS缓存
  4. 68.Android之透明状态栏
  5. Nodejs开源项目推荐
  6. 关于DOM树的常见增删操作
  7. Eclipse中设置JDK内存方式
  8. TCP/UDP详解
  9. 排队(BZOJ1731:[Usaco2005 dec]Layout 排队布局)
  10. 安装使用GYP,并编译libpomelo2
  11. session 与 cookie (一)
  12. python selenium 爬取淘宝
  13. python open函数的坑
  14. 常用的.NET开源项目(转)
  15. Com类型
  16. Mockito学习1
  17. 前端基础-html 介绍和head标签 ( 1 )
  18. HTML DOM item() 方法
  19. UEditor插入视频,Object Iframe等标签被过滤问题处理
  20. NSOperation的使用细节 [1]

热门文章

  1. 手机、ESP32单片机、MQTT服务器连接实验
  2. uniapp(1)
  3. (1028) 权限,chmod、chgrp、chown详解
  4. Delphi 新语法:匿名函数
  5. MCU构成及其运行原理
  6. 提取可执行文件中的调试信息 objcopy --only-keep-debug app app.debug
  7. 虚拟机中debian11修改控制台(console)分辨率|linux控制台分辨率|linux console resolution
  8. DSL语言思想的应用
  9. pyton3 字典排序
  10. SpringBoot(十五)单个以及多个跨域的配置方法