foo = "bar"
function testThis(){
this.foo = 'foo'//this为testThis这个函数(对象)
}
console.log(this.foo);//bar
new testThis();//创建了一个对象,该对象的foo = 'foo',
console.log(this.foo);//bar
console.log(new testThis().foo)//foo
new一个对象将会发生的事情
最新推荐文章于 2022-06-15 17:10:35 发布