const CONSTANT_VALUE = "someValue";
This works in almost all browsers.
var CONSTANT_VALUE = "someValue";
Local variables with block scope can be declared with const. Assuming, we have a constant variable a. After declaring a value like a constant variable, you can’t assign a new value to it:
// declared ‘a’ as a constant variable. const a = 200; // Assigning a new value to `a` will fail since ‘a’ is a constant variable a = 0; a++; // The below declarations won’t work var a = 0;
The const Variable¶