JS-07- function

. 1 <! DOCTYPE HTML>
 2 <HTML>
 . 3      <head>
 . 4          <Meta charset = "UTF-. 8">
 . 5          <title> </ title>
 . 6      </ head>
 . 7      <body>
 . 8          <Script type = "text / JavaScript ">
 . 9  //             use the function keyword-defined function: the function calls and has no defined function 
10              Demo ();
 . 11              function Demo () {
 12 is                  Alert ( 'function is called' );
 13              }
 14  //            in expression defined function (anonymous function):Defined functions and has the calling function, the former is defined, called after 
15              var   the demo1 = function() {
 16                  Alert ( 'function to jump out' );
 . 17              };
 18 is              the demo1 ();
 . 19              
20 is              
21 is  //           function parameter passing 
22 is              function demo2 (A, B) {
 23 is                  the console.log ( 'function is called' );
 24                  the console.log (A, B);
 25                  the console.log (arguments);
 26 is                  for (I in arguments) {
 27                      the console.log (arguments [I]);
 28                  }
 29              }
 30              demo2 (100,200,300,400);
31         </script>
32     </body>
33 </html>

 

Guess you like

Origin www.cnblogs.com/qinqin-me/p/11266797.html