The usage of  bind  is to define a specified scope for called function. Because the key this is easy to refer another objet, experically window, instead of itself. Please pay attention to look at the following example:

 //Global variables
window.name="Chromium"; var person={
name:"Pin"
} function say()
{
alert("My name is "+this.name+"!");
} say(); //the result is : My name is Chromium! var sayfunction=say.bind(person); sayfunction(); //the result is : My name is Pin!

When the function say assign to a variable sayfunction, the scope of this function has been changed. However, if you use the function of bind  to refer a specified object person, the scope will own the refer object person.

最新文章

  1. NPOI导出Excel合并表头写入公式
  2. xp下安装jdk8
  3. 手机WebAPP设计注意事项和解决方法
  4. leetcode Linked List Cycle
  5. 【BZOJ-1406】密码箱 约数 + 乱搞 + set?
  6. GPU优化方法[转]
  7. android依赖工程,子工程覆盖父工程的相同属性
  8. FusionCharts(v3.6.0)使用(1)
  9. js中的referrer使用,返回上一页
  10. jQuery ajax在GBK编码下表单提交终极解决方案(非二次编码方法)(转)
  11. Delphi Windows API判断文件共享锁定状态(使用OpenFile来判断)
  12. win7兼容oracle
  13. windows 下编译php扩展库pecl里的扩展memcache
  14. Struts2 设置global timer
  15. 跟我一起写Makefile(转)
  16. MIUI10系统怎么样刷成开发版获得ROOT权限
  17. linux中centros6.7安装php5.6,httpd-2.2.19(web产品化)遇到的问题总结
  18. 企业环境下的OpenStack自动化功能测试(转载)
  19. 8-06. 畅通project之局部最小花费问题(35)(最小生成树_Prim)(ZJU_PAT)
  20. html5-css渐变应用小实例,按钮

热门文章

  1. Tournament Chart【模拟+vector+map+string】
  2. 在Unix系统中执行可执行文件
  3. cb11a_c++_顺序容器的操作4_容器大小操作_resize-max_size
  4. python 2 与python 3区别汇总
  5. 前端笔记(关于解决打包时报node-sass错误的问题)
  6. egret的WebView实现
  7. POJ 3463 Sightseeing 【最短路与次短路】
  8. Spring Security(一) —— Architecture Overview
  9. 2020年Web前端开发工程师市场怎么样?学会什么技术才能拿到高薪
  10. lambda表达式与函数式(FunctionalInterface)接口