javascript函数一

javascript函数1/*javascript函数的定义方式分为俩种 1 通过function语句定义又分为俩种function f(){...}

javascript函数1

/*javascript函数的定义方式分为俩种 1 通过function语句定义     又分为俩种     function f(){...}   //命名方式     var fun = f(){...}; //匿名方式 2 通过Function对象来定义*/
<script type="text/javascript">/**/        function aa(e){            document.write(e+"<br/>");        }        function t1(){  //            aa("11");        }        t1();        function t1(){            aa("new 11");        }        t1();        t1 = function(){            aa("new new 11");        }        t1();    </script>


以上代码执行后 依次得到 new 11,new11,new new 11。
而不是一些人认为的 11,new 11,new new 11。
这是因为 声明函数定义的代码优先于函数执行代码被解析器解析,
而引用函数定义,或者说函数表达式则是在函数运行中动态解析的。