11.
Where should let variables be declared to avoid TDZ issues?
12.
What is the scope of a variable declared with let inside a loop?
13.
What will be the output of the following code?
for (let i = 0; i < 3; i++) { setTimeout(() => console.log(i), 0); }
14.
What is the advantage of using let over var?
15.
What will be the output of the following code?
let f = 10; if (true) { console.log(f); let f = 20; }
16.
Which keyword should be used to declare variables that do not get re-assigned?
17.
What is the difference between let and var in terms of scope?
18.
What will be the output of the following code?
let h = 40; { console.log(h); h = 45; } console.log(h);
19.
How can you avoid variable hoisting issues with let?
20.
What will be the output of the following code?
let i = 50; { let i = 55; console.log(i); } console.log(i);