📜  闭包和作用域 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:08.156000             🧑  作者: Mango

代码示例1
function outerFunction () {
  const outer = `I'm the outer function!`

  function innerFunction() {
    const inner = `I'm the inner function!`
    console.log(outer) // I'm the outer function!
  }

  console.log(inner) // Error, inner is not defined
}