2

So I see many code where an instance is created without the parenthesis. for e.g.

var o = new f

Instance without parenthesis - Chrome console

Does it differ in any way to the usual way of creating instances ie. with parenthesis other than the fact that parenthesis allows to pass arguments.

var o = new f()

Also, is the new keyword that executes the function (without parenthesis) as mentioned in this answer What-is-the-new-keyword-in-javascript, particularly this line:

It executes the constructor function, using the newly created object whenever this is mentioned.

Thanks

appu
  • 402
  • 3
  • 20

0 Answers0