下面代码什么意思啊
class A{
static instance(...args) {
this.i = this.i || new this(...args)
return this.i
}
}
this.i = this.i || new this(...args)完全看不懂啊,这里this.i是个什么鬼
new this(...args)又是什么?
下面代码什么意思啊
class A{
static instance(...args) {
this.i = this.i || new this(...args)
return this.i
}
}
this.i = this.i || new this(...args)完全看不懂啊,这里this.i是个什么鬼
new this(...args)又是什么?
13 回答12.9k 阅读
7 回答2.1k 阅读
3 回答1.3k 阅读✓ 已解决
2 回答1.3k 阅读✓ 已解决
6 回答1.2k 阅读✓ 已解决
6 回答1.1k 阅读
3 回答1.3k 阅读✓ 已解决
短路。等同於:
new this(...args)
is equal tonew A(...args)
.