← Week 4 — 17 / 24 →

ES6 New Features: const

The const keyword creates a read-only reference to a value. It does not mean the value it holds is immutable, just that the variable identifier cannot be reassigned.

var x = 1;
const y = 2;
const z = {a: 1, b: 2};
...
x=0;  // ok
y=4;  // error
z.a = 3;  // ok