Declared and undeclared variables in functions

ref –

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.