Paragraph:
Encountering var students, Compiler will ask Scope Manager to see if a variable named students already exists for that particular scope bucket. If so, Compiler would ignore this declaration and move on. Otherwise, Compiler will produce code that (at execution time) asks Scope Manager to create a new variable called students in that scope bucket.
Question:
I have a confusion about the above paragraph. If the Compiler produces code that asks Scope Manager to create a new variable at execution time, then how Scope Manager knows about the variable when Compiler encounters var students, let's say for second time. This is my first deep dive into the language, pardon me if it is a trivial question.
I already searched for this issue:
Edition: 2nd
Book Title: Scope & Closures
Chapter: Chapter 2: Illustrating Lexical Scope
Section Title: A Conversation Among Friends
Paragraph: Encountering
var students
, Compiler will ask Scope Manager to see if a variable namedstudents
already exists for that particular scope bucket. If so, Compiler would ignore this declaration and move on. Otherwise, Compiler will produce code that (at execution time) asks Scope Manager to create a new variable calledstudents
in that scope bucket.Question: I have a confusion about the above paragraph. If the Compiler produces code that asks Scope Manager to create a new variable at execution time, then how Scope Manager knows about the variable when Compiler encounters
var students
, let's say for second time. This is my first deep dive into the language, pardon me if it is a trivial question.