javascript-tutorial / javascript-tutorial/en.javascript.info
closures - uninitialized vs undefined
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- HTML
- Star
- 25.5k
- Fork
- 4k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với các phần về môi trường từ vựng và hàm lồng nhau trong bài viết về closure, sau đó so sánh các nhãn trong lexenv-nested-makecounter-2.svg và lexenv-nested-makecounter-3.svg. Xác minh xem các sơ đồ có nên phân biệt với undefined hay không, và chỉ cập nhật các SVG đó nếu hành vi của JavaScript ủng hộ việc sửa như đề xuất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- documentation
- Loại issue
- Tài liệu
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 55/100