What is the difference between "var" and "let" Keywords?
Both are used for function declaration in JavaScript but the difference are given below :-
let | var | |
---|---|---|
1. | It can be only available inside the scope it's declared, like in for loop. | It can be accessed outside the loop. |
2. | It is block scoped. | It is function scoped |
BY Best Interview Question ON 25 Aug 2022