括号一般使用主要集中在函数 :

  function fn(){};

2.新建对象

  arr = new arry();

3.执行函数

 function Test(){ alert('test')} ();  它会自动执行 就是当页面加载的时候就执行..

 eg:

<script language="JavaScript">
var MarkTime = function( name, desc ) { alert('MarkTime')};
var MarkTime1 = function( name, desc ) { alert('MarkTime1')}();
</script>

4.匿名函数

 (function(){ alert('test')});   匿名函数后面一般都会跟着执行的"()"!

eg:

 (function(){ alert('test')});()

传参数:

 (function(){ alert('test')});(alert('dd'))  先弹出dd,再弹出test

 (function(o){ alert('test')});('dd')        dd作为参数传进去

 

相关文章:

  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2022-03-01
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
相关资源
相似解决方案