javascript-tutorial / javascript-tutorial/en.javascript.info
closures - uninitialized vs undefined
- 主要语言
- HTML
- 星标
- 25.5k
- 派生
- 4k
- PR 合并指标
- 30 天内没有已合并 PR
描述
in [this article](https://javascript.info/closure), we are discussing lexical environments, and the scope of variables.
upon initialization, variables are defined as `` because "[the engine knows about the variable, but it cannot be referenced until it has been declared with `let`](https://javascript.info/closure#step-1-variables)"
later in the article, when referencing nested lexical environments in functions, a variable is initialized as `undefined`. from my understanding, this is incorrect, as the engine knows about the variable, but is not referenced yet since it hasn't been declared.
i believe that we need to change the following SVG's to reflect this change:
https://github.com/javascript-tutorial/en.javascript.info/blob/master/1-js/06-advanced-functions/03-closure/lexenv-nested-makecounter-2.svg
https://github.com/javascript-tutorial/en.javascript.info/blob/master/1-js/06-advanced-functions/03-closure/lexenv-nested-makecounter-3.svg
if this is an incorrect assumption, please help me understand why it's undefined instead of uninitialized! i'd love to learn more about how this all works.
贡献指南
这个仓库没有索引到贡献指南
调研方向
先从 closure 文章中关于词法环境和嵌套函数的部分开始,然后比较 lexenv-nested-makecounter-2.svg 和 lexenv-nested-makecounter-3.svg 中的标签。验证这些图是否应将 与 undefined 区分开来,并且仅在 JavaScript 的行为支持所提议的修正时更新这些 SVG。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100