ES6 provides a new way of declaring a constant by using the const keyword which creates a read-only reference to a value:
const CONSTANT_VALUE = "someValue";
This works in almost all browsers.
Local variables with block scope can be declared with const. Assuming, we have a constant variable CONSTANT_VALUE. After declaring a value like a constant variable, you can’t assign a new value to it:
The constant cannot change through re-assignment constant cannot be re-declared. Const can be changed if it is an object because when you're adding to an array or object you're not re-assigning or re-declaring the constant, it's already declared and assigned, you're just adding to the "list" that the constant points to. So this works fine:
The const Variable