CNode

理解node技术当中的bind函数方法迷惑的地方,求大神指导~

Lliubenben发布于13 年前最后回复13 年前2 回复4882 浏览0 收藏
var someuser = {
  name: 'byvoid',
  func: function () {
    console.log(this.name);
  }
};
var foo = {
  name: 'foobar'
};
func = someuser.func.bind(foo);
func(); // 输出 foobar
func2 = func.bind(someuser);

func2(); // 输出 foobar

括号里面这个地方就是不明白的地方 为什么没有变

查看回复

回复 (2)

B
brighthas#1·13 年前

because nested closure.


签名: 交流群244728015 《Node.js 服务器框架开发实战》 http://url.cn/Pn07N3

L
liubenben#2·13 年前

thank you~

参与回复
登录后即可参与回复。登录