DEV Community

Discussion on: Is`let` the new `var` in Javascript?

Collapse
 
littlephone profile image
littlephone • Edited

Although as Ellen says, using let could prevent re-declaration of variables, using it can cause issues in older browsers like Internet Explorer. Personally I will use var instead and I will be pretty careful about the variable names.

The variable name I set is as less generic as possible to reduce the possibility to be re-declared.

Collapse
 
amitkhonde profile image
Amit Khonde

You use var inside blocks (like if-else and loops) also? There I use let because it will prevent accidental value changes in the variable.