Модуль сфера действия JavaScript
In JavaScript, scopes are created by code blocks, functions, modules.
While const and let variables are scoped by code blocks, functions or modules,
var variables are scoped only by functions or modules.
Scopes can be nested.
Inside an inner scope you can access the variables of an outer scope.
Gor Baghramyan