+ 2
What difference between let and var?
6 Respuestas
+ 12
let can be used inside function and ...var can be used in any part of te code
+ 11
I think that let is for constants and var is for variables. Constants can't be changed. The value of a variable can be changed.
+ 2
let is used to declare constants and var is used to declare variable.
Constants are those whose value we can't change and variable are those whose value can be change as many times as we want.
+ 1
yes you all are right
0
Whenever we want to assign a fix value like value of pi, we use let keyword as constant so that the value cannot be overridden or get changed. If we want to put the value that will get changed later on, then we use var keyword for variable.
0
Both let and var are variables. const is a constant.
https://medium.com/craft-academy/javascript-variables-should-you-use-let-var-or-const-394f7645c88f