执行上下文是否有权访问另一个执行上下文的数据?

Has an execution context access to the data of another execution context?

提问人:FrankUP 提问时间:2/18/2023 更新时间:2/18/2023 访问量:35

问:

例如,如果我有以下代码:

const text = "hello";

function func(){
  return text;
}

func();

当我调用函数 func() 时,将在全局执行上下文的顶部生成一个新的执行上下文,这就是我的问题,函数的执行上下文如何访问常量文本,执行上下文是否直接访问全局执行上下文中的数据或附加到函数有一个闭包,因此它可以访问它需要的数据?

JavaScript 函数 闭包 callstack executioncontext

答: 暂无答案