1 <!DOCTYPE html> 2 <!-- return 同python中return效果一样 --> 3 <html lang="en"> 4 <head> 5 <meta charset="UTF-8"> 6 <title>Document</title> 7 <script type="text/javascript"> 8 function fnAdd(a, b){ 9 var iNUM = a + b; 10 return iNUM; 11 } 12 var a = fnAdd(3,5); 13 alert(a) 14 </script> 15 </head> 16 <body> 17 18 </body> 19 </html>