Day12匿名函数的表达式

image
image

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>匿名函数表达式</title>
</head>

<body>
  <script>
    // re 在这里调用则会报错

    // 匿名函数表达式
    let re = function (x, y) {
      // console.log(`这是匿名函数表达式`)
      console.log(x + y)

    }
    re(1, 3)

    // 与具名函数不同的是,匿名函数的调用只能在变量声明之后
    // 具名函数则没有这个限制
    fun()
    function fun() {
      console.log(`沉住气`)
    }
  </script>
</body>

</html>
posted @ 2026-01-12 21:11  冰涿  阅读(2)  评论(0)    收藏  举报