函数名称

<!DOCTYPE html>
<html>
          <head>
                 <meta charset="utf-8">
                 <title></title>
          </head>
          <body>
                  <script type="text/javascript">
                  test();
                  function test(){
                           alert('this is a test');
                   }                                                            函数名称严格区分大小写

                  function  TEST(){
                           alert("hello king");
                   }
                TEST();
                test();
                function test(){
                       alert('hello nana');                                 函数名称重复会产生覆盖
                }
                test();                                                                               
                function test1(){
                           alert('this is test1 function');
                }
                //alert(test1());
                 function test2(){
              // return null;
              // return undefined;
              // return;
             // return true;
             // return 'this is king';
             // return 1.2;
            alert('this is a test');
             // return 1;
            }
          //alert(typeof (alert('this is a test')));


            function calc(num1,num2){
                    return num1+num2;
            }
             // alert(calc(1,2));
              // alert(window.calc(3,5));
              // alert(calc(1,2,3,4,5,6));
           function calc1(num1=1,num2=2){
                     return num1+num2;
           }
           function calc1(num1,num2){
                    num1=num1||1;
                    num2=num2||2;
                    return num1+num2;
            }
             alert(calc1());
             </script>
       </body>
</html>

posted @ 2018-08-27 17:38  邓志娇  阅读(229)  评论(0编辑  收藏  举报