Nice Doodle by Abhishek Kumar explaining the difference between JavaScript’s var
, let
, and const
:
Good to see hoisting is also explicitly mentioned by name.
πββοΈ I personally always start with const
. Only if I need to reassign a variable’s value (for example: a counter in a loop) I use let
. I see no good reason to use var
.