Is there a recommended naming convention for key names within a const object in es6? I haven\'t been able to find a resource which states if they should be uppercase or lowercas
NOTE: be aware that the accepted response has a link to an obsolete Google style guide
This is nice (string literals or integer literals):
const PI = 3.14;
const ADDRESS = '10.0.0.1';
but...
const myObject = { key: 'value' };
const userSuppliedNumber = getInputNumber()
Google JavaScript Style Guide says:
Declare all local variables with either const or let. Use const by default, unless a variable needs to be reassigned. The var keyword must not be used.
Every constant is a @const static property or a module-local const declaration, but not all @const static properties and module-local consts are constants. Before choosing constant case, consider whether the field really feels like a deeply immutable constant. For example, if any of that instance's observable state can change, it is almost certainly not a constant. Merely intending to never mutate the object is generally not enough.
JavaScript.info says:
...capital-named constants are only used as aliases for “hard-coded” values.