Constructor invocation without parentheses [duplicate]

Is there any difference between

var obj1 = new Constructor;

and

var obj2 = new Constructor();

given that Constructor is a constructor function?

Answers:

Answer

According to the MDN docs:

[...] "new foo" is equivalent to "new foo()", i.e. if no argument list is specified, "foo" is called without arguments.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.