javascript-tutorial / javascript-tutorial/en.javascript.info
closures - uninitialized vs undefined
- Linguagem predominante
- HTML
- Estrelas
- 25.5k
- Forks
- 4k
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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.
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Comece pelas seções sobre ambiente léxico e funções aninhadas do artigo sobre closures e, em seguida, compare os rótulos em lexenv-nested-makecounter-2.svg e lexenv-nested-makecounter-3.svg. Verifique se os diagramas devem distinguir de undefined e atualize esses SVGs somente se o comportamento do JavaScript der suporte à correção proposta.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript
- Domínio
- documentation
- Tipo de issue
- Documentação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Pouca atividade
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 55/100