0
In other course variables vere noted with let, in which cases i should use let and in which var ?
2 odpowiedzi
+ 2
Let is only usable in its declared position. Lets say you started a function and in there, there is an if condition. You declared a let in there. You cant use that in other parts in the function. But if you use var in there, you can use it everywhere. You can use it to avoid confusion.
+ 1
Usually in ECMAScript 6, you should use let for less confusion.
(Also, if you know something will be constant, you should always use const)