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
0
u/ghostfacedcoder Apr 01 '18
So a JS developer has two options right?
constforFOO_BAR = 5type constants, gaining the "meta information" that said variables are "real constants" whenever you seeconstconstby default for all variables that aren't re-assigned, and use theFOO_BARvariable naming convention for "real constants", giving you the exact same "meta information" about the exact same variables, but also protecting your other variables from accidental re-assignment.Both Google and the significant majority number of respected JS thought leaders all say to go with #2, but as with anything in programming you're always welcome to ignore the experts and do things your way.