what is the difference between a var and a let in JavaScript?
First answer will be the brainliest..........................
Answers
Answered by
1
Answer:
The main difference between let and var is that scope of a variable defined with let is limited to the block in which it is declared while variable declared with var has the global scope. So we can say that var is rather a keyword which defines a variable globally regardless of block scope.
Answered by
0
var and let are both used for variable declaration in javascript but the difference between them is that var is function scoped and let is block scoped.
It can be said that a variable declared with var is defined throughout the program as compared to let.
Similar questions
Math,
3 months ago
Math,
3 months ago
India Languages,
7 months ago
Math,
7 months ago
Economy,
1 year ago