在这三个函数里,this 都是window,所以this.name是全局变量name。第一个函数FF里面的 name 没有加var,所以,这个name是全局变量。 因此,在执行 new FF() 的时候,name 被赋值为 "haha" http://zonxin.github.io/post/2015/11/javascript-this
在这三个函数里,
this
都是window
,所以this.name
是全局变量name
。第一个函数
FF
里面的name
没有加var
,所以,这个name
是全局变量。因此,在执行
new FF()
的时候,name 被赋值为 "haha"http://zonxin.github.io/post/2015/11/javascript-this