this.x = 1;
//全局引用 this指向全局对象
console.log("全局引用 this指向全局对象: ", this);
console.log("this.x: ", this.x);
//函数调用 this指向全局对象
function test(){
this.x = 2;
console.log("test调用 this指向: ", this);
}
//test();
//console.log("this.x: ",this.x);
//对象方法调用 this指向调用方对象
var obj = {x:3};
obj.test = window.test
//obj.test();
//console.log("obj.x: ", obj.x);
//new创建 this指向新创建对象
//var foo = new test();