标签: javascript node.js class static
在PHP中,它是$instance = new static();
$instance = new static();
您如何在nodejs中做到这一点?
通过静态方法
答案 0 :(得分:1)
this是指静态方法中的类构造函数。
this
是:
class Foo { static factory() { return new this(); } } Foo.factory();