Analyze the code snippet. Identify which variables are local and which are global;
let name; let age; { let profession; { let height; let weight; }
- name ==> Global
- profession ==> Local
- age ==> Global
- height ==> Local
- weight ==> Local
Answers Explanation & Hints:
In the given code snippet, the variables can be classified as follows: Global variables:
Local variables within the innermost block:
Based on the scope of the variables, On the other hand, |