If you want to know the lexical scope of JavaScript, you need to know about the scope first.
Two types of Scope (Layer Special) are used to run JavaScript code or programs such as Global Scope and Functional/Local Scope. When executing JavaScript engine code or programs, look for variables from Local…