15.函数.html 530 B

12345678910111213141516171819202122232425
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <!--
  10. function 名字(形参) {
  11. 代码块
  12. return 反出内容
  13. }
  14. 名字(实参)
  15. -->
  16. <script>
  17. function fn1(x) {
  18. console.log("这是我的第一个函数"+x)
  19. return 1 + x;
  20. }
  21. fn1(3);
  22. console.log(fn1(4));
  23. </script>
  24. </body>
  25. </html>