DEV Community

Discussion on: Do you know javascript?

ervin_szilagyi profile image
Ervin Szilagyi • Edited on

It should print undefined.
This is because of hoisting which happens to variable a. In case of declaring a variable with var keyword, the variable is hoisted to the current execution context, which for a is the enclosing function.