在 PHP 中它是 $instance = new static();
你如何在 nodejs 中做到这一点?
来自静态方法
最佳答案
this
引用静态方法中的类构造函数。
它是:
class Foo {
static factory() {
return new this();
}
}
Foo.factory();
关于javascript - 从静态方法中创建实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52595060/