DEV Community

Discussion on: Demystifying "const" variables in JavaScript

Collapse
 
sunnysingh profile image
Sunny Singh • Edited

I do, for real constants that are static values. Consider this example:

const BASE_URL = 'http://example.com';

const url = `${BASE_URL}/hello`;

Since url isn't a true constant (it uses another variable to determine its value), I keep it lowercase.

Also, I only use constant case at the top level scope, or when I'm importing constants from another file.