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
5
u/ghostfacedcoder Apr 01 '18
Not common, no. In fact, with the way I code functions are rarely even big enough for something like that to happen.
But at the same time, all it takes is one long function (your's or your co-worker's) and one
varto potentially introduce a time-consuming bug, so why not useconst? Other than the two extra characters there is absolutely no downside whatsoever to using it.As soon as you adjust to using
constinstead ofvarit just becomes a habit, and then you're protected everywhere you define a variable by habit.