首页 > 解决方案 > 作为函数参数传递的函数范围

问题描述

document.getElementById('game').addEventListener('click', function startGame() {
  console.log('Game is starting!'); // name of the function is given just for debugging purposes
});

startGame 函数的作用域是什么?这个函数在哪里可以访问(在哪里可以调用)?

标签: javascriptfunctionscopeargumentsanonymous-function

解决方案


推荐阅读