Declared and undeclared variables in functions

ref – https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var

Declared variables are constrained in the execution context in which they are declared.

Undeclared variables are always global

…even in inner functions

Let’s declare an inner function called ‘inner’. We have an undeclared variable ‘name’.
That name will be declared as a global. It will be accessible by all scopes.