GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — closures - uninitialized vs undefined · Issue #3895 · javascript-tutorial/en.javascript.info

closures - uninitialized vs undefined #3895

New issue
Copy link
New issue
Copy link
Open
Open
closures - uninitialized vs undefined#3895
Copy link

Description

@aredmondd
aredmondd
opened on Oct 17, 2025
Issue body actions

in this article, we are discussing lexical environments, and the scope of variables.
upon initialization, variables are defined as <unitialized> because "the engine knows about the variable, but it cannot be referenced until it has been declared with let"

Image Image

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.

Image Image

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.

Activity

  1. joaquinelio commented on Oct 19, 2025

    @joaquinelio
    joaquinelio
    on Oct 19, 2025
    Member
    More actions

    I think at that point the execution already passed the let declaration,
    so it's not "uninitialized".

    note:
    chatgpt "partialy" agrees wirh a long explanation i didnt read.
    then concludes the issue is wrong.
    And offered a step by step correlation code-svg
    i didnt read either.
    Sorry my lazyness.

  2. sujayhegde23 commented on Jul 9, 2026

    @sujayhegde23
    sujayhegde23
    on Jul 9, 2026
    More actions

    @aredmondd
    could you mention which variable is initialized has undefined . are you referring to the counter variable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.