更新时间:2023-11-12 14:07:16
两个声明都是正确的,但它们有不同的语义。
Both declarations are correct but they have different semantics.
第一种类型的声明允许您创建对象的实例:
The first type of declaration allows you to create instances of your objects:
var t = new myObject();
// then use t
t.myProperty = "some value";
var otherT = new myObject();
otherT.myProperty = "some other value";
第二个几乎就像一个静态对象:
The second is almost like a static object:
myObject.myProperty = "some value";