Can we omit parentheses when creating an object using the “new” operator?

I have seen objects being created this way:

const obj = new Foo;

But I thought that the parentheses are not optional when creating an object:

const obj = new Foo();

Is the former way of creating objects valid and defined in the ECMAScript standard? Are there any differences between the former way of creating objects and the later? Is one preferred over the other?

6 Answers
6

Leave a Comment