0

I am wondering if there any difference between new FunctionOne and new FunctionOne() where FunctionOne is defined as

 function FunctionOne(){
   /// this function has no arguments
   ///some code 
 }
Anoop
  • 23,044
  • 10
  • 62
  • 76
  • 2
    possible duplicate of [new MyObject(); vs new MyObject;](http://stackoverflow.com/questions/3034941/new-myobject-vs-new-myobject) – Felix Kling Sep 08 '12 at 19:09
  • 1
    I would imagine the parentheses allow you to pass arguments. – Blender Sep 08 '12 at 19:09
  • 1
    possible duplicate of [Parentheses after "new " optional?](http://stackoverflow.com/questions/6439290/parentheses-after-new-function-optional) – Brandon Boone Sep 08 '12 at 19:09

1 Answers1

0

There is no difference but to pass arguments when operator () is used. Other than that, both can be used to having the same effect. For example.

( new Date() ).getTime();

is the same as

( new Date ).getTime();
David G
  • 94,763
  • 41
  • 167
  • 253