Function usage scenario - as another variable value

As a function of the value of other variables. It can be called directly;

 

 1 <!DOCTYPE html>
 2 <html lang="zh">
 3 
 4 <head>
 5     <meta charset="UTF-8">
 6     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 7     <meta http-equiv="X-UA-Compatible" content="ie=edge">
 8     <title>Document</title>
 9 </head> 
10  
. 11  < body > 
12 is  
13 is      < Script > 
14  
15  
16  
. 17          function foo (X, Y) {
 18 is              IF (X > Y) {
 . 19                  return X;
 20 is              } the else {
 21 is                  return Y;
 22 is              }
 23 is          }
 24  
25          / / the foo variable as a function of the value of the bar 
26 is          var bar = foo;
 27  
28          the console.log (foo ( 12 is, 88))
29         console.log(bar(12, 66))
30 
31     </script>
32 </body>
33 
34 </html>

 

Guess you like

Origin www.cnblogs.com/wszzj/p/12006805.html