使用大括号和不使用bracs调用函数的区别

difference between calling function with braces and without bracs

本文关键字:函数 调用 区别 bracs      更新时间:2023-09-26

我想知道new FunctionOnenew FunctionOne()之间是否有区别,其中FunctionOne被定义为

 function FunctionOne(){
   /// this function has no arguments
   ///some code 
 }

使用运算符()时,除了传递参数外,没有任何区别。除此之外,两者都可以习惯于具有相同的效果。例如

( new Date() ).getTime();

与相同

( new Date ).getTime();