Q. The main difference between the variables declared with var and with let is

  • (A) var is confined to a particular function but let is not
  • (B) let is confined to a particular function but var is not
  • (C) var defines values based on conditions but let does not
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) let is confined to a particular function but var is not
Explanation: Variables declared with var are defined throughout the enclosing function. Variables declared with let are defined only within the closest enclosing block (and any blocks nested within it, of course).
Explanation by: Mr. Dubey
Variables declared with var are defined throughout the enclosing function. Variables declared with let are defined only within the closest enclosing block (and any blocks nested within it, of course).

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
162
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
94%
Success Rate