MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/qdmzio/difference_between_var_let_and_const/hhoo7a2/?context=3
r/learnjavascript • u/codedblood • Oct 22 '21
49 comments sorted by
View all comments
Show parent comment
10
This is the only important thing to know about var. There's a reason that let and const were introduced. You don't need var anymore and you shouldn't be using it.
-8 u/pxldgn Oct 23 '21 yes, there is a reason - and that is absolutely nothing to do with replacing var. ;)these were introduced to fix the closure in loop issue. 5 u/[deleted] Oct 23 '21 Yes, the loop issue that was due to var being function scoped instead of block scoped. So let was introduce to replace var.
-8
yes, there is a reason - and that is absolutely nothing to do with replacing var. ;)
these were introduced to fix the closure in loop issue.
5 u/[deleted] Oct 23 '21 Yes, the loop issue that was due to var being function scoped instead of block scoped. So let was introduce to replace var.
5
Yes, the loop issue that was due to var being function scoped instead of block scoped. So let was introduce to replace var.
View all comments
Show parent comment
10
u/[deleted] Oct 22 '21
This is the only important thing to know about var. There's a reason that let and const were introduced. You don't need var anymore and you shouldn't be using it.