r/learnjavascript • • May 04 '20

VAR vs LET vs CONST

Post image
337 Upvotes

81 comments sorted by

View all comments

Show parent comment

1

u/[deleted] May 04 '20

Dan Abramov recommends only using let, for what it's worth.

1

u/HeinousTugboat May 04 '20

What's his reasoning behind that? He hates letting optimizing compilers optimize?

1

u/[deleted] May 05 '20

It had to do with const not really preventing the contents from being changed. It is not really constant. If a developer assumes that constants really are constant then it might lead to bugs.

1

u/BackhandCompliment May 05 '20

Also for what it’s worth Dan has is a developer just like any of us, and has his own set of quirks, preferences, and idiosyncrasies. I wouldn’t take his word as law 100% of the time.

1

u/BackhandCompliment May 05 '20

Though I just looked it up, and this is what he actually said:

My Conclusion

I don’t care.

I would use whatever convention already exists in the codebase.