new MyClass(); vs new MyClass;
- by Bytecode Ninja
In some JavaScript code snippets (e.g. http://mckoss.com/jscript/object.htm) I have seen objects being created in this way:
var obj = new Foo;
However, at least at MDC, it seems that the parentheses are not optional when creating an object:
var obj = new Foo();
Is the former way of creating objects valid and defined in the ECMA standard? Are there any differences between the former way of creating objects and the later? Is one preferred over the other?
Thanks in advance.