Analyze the code snippet:
let name; let age; { let height; // 2 { // 2 { let weight; // 1 // 2 console.log(name); // 1 // 2 // 2 console.log(name); // 2 }
We have access to the weight
variable:
- in the part marked 1.
- throughout the program.
- nowhere, as we have no access at all (the variable has not been initialized).
- in the part marked 2.
Answers Explanation & Hints:
|