746560
文件test.js内容如下:
var fruit = "apple";
function test(){
console.log(this.fruit);
}
test();
//console.log(this);
执行 node test.js, 结果为 “undefined”. 修改 var fruit = "apple"; ==> this.fruit = "apple", 结果为 “undefined”. 修改 var fruit = "apple"; ==> fruit = "apple", 结果为 “apple”. 如果理解这三种定义的不同? test函数外的this 和 函数内的this 有何不同?