首页
技术
登录
6mi
u
盘
搜
搜 索
技术
new一个对象将会发生的事情
new一个对象将会发生的事情
技术
2024-04-02
94
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
转载请注明原文地址:https://ipadbbs.8miu.com/read-48601.html
最新回复
(
0
)