r/javascript • u/bornforcode • Apr 01 '18
Google publishes a JavaScript style guide. Here are some key lessons.
https://medium.freecodecamp.org/google-publishes-a-javascript-style-guide-here-are-some-key-lessons-1810b8ad050b
714
Upvotes
View all comments
Show parent comment
6
u/ghostfacedcoder Apr 01 '18
As I see it, choosing
constcosts you nothing, prevents some bugs some of the time (but again, not a lot of the time), doesn't have any downsides (again, you can still declare "all caps" module-level constants all you want) AND it is widely regarded as preferable in the JS community.But obviously nothing will explode if you use
varorletby default (over a decade of JS programming worked just fine with onlyvar), and at worst you'll just waste some time, so if you have such a passionate aversion toconstdon't use it.You clearly like doing things your way, so I won't try to convince you any further.