JavaScript Tutorial
JS Const
Using const
Declare constants with const. These must be initialized at declaration and cannot be reassigned.
Immutability and Scope
Const variables are block-scoped and immutable for primitive values. For objects and arrays, the binding is constant but properties or elements can change.
Examples
const PI = 3.14; const arr = [1,2,3]; arr.push(4); // Allowed // PI = 3.1415; // Error