0
Whats the diffrence between let and var in JavaScript
Let x = 10; var x = 10;
3 Réponses
+ 1
Both are variables only but only difference is let block scoped u will have access only to that block like 'for' block and 'while' block ,
:>var is function scoped u can access anywhere in that function.
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.