Search Interview Questions | Click here and help us by providing the answer. Click Correct / Improve and please let us know. |
|
|||
|
| ||||
| Interview Questions and Answers | ||||
| ||||
| Ans. Var scopes the variable to the nearest function whereas Let scopes the variable to nearest block. For example - function printNumbers() { for(var i = 1; i < 3: i++){ console.log(i); } console.log(i); // works fine and will print 3 as i has a function scope and not local loop scope } | ||||