In JavaScript, 'var' declarations are hoisted to the top of their scope, but the initialization stays in place. This can lead to 'undefined' values before the actual assignment.
5.
Given 'var a = 1; var a = 2;', what is the value of 'a' after these statements execute?
'let' is block-scoped, meaning it is only accessible within the block it is defined. 'var' is function-scoped and accessible throughout the function it is declared in.
7.
What will be the result of executing 'let x = 1; let x = 2;' in the same scope?
Redeclaring a variable with 'var' in the same scope can lead to unintended consequences such as overwriting the previous variable, leading to potential bugs.
10.
What does 'TDZ' stand for in the context of JavaScript?
'TDZ' stands for Temporal Dead Zone, which refers to the state where variables are not accessible until their binding is fully initialized, applicable to 'let' and 'const'.