【发布时间】:2020-03-10 09:30:28
【问题描述】:
这两个例子在功能上有区别吗?为什么你更喜欢其中一个?
静态属性:
class FirstExample {
static baz = "Something";
static biz = 10;
//rest of class
}
使用类名添加:
class SecondExample {
//Rest of class
}
SecondExample.biz = "Something";
SecondExample.baz = 10;
【问题讨论】:
-
第一个更独立,更少重复......?!
标签: javascript class static