const
creates an immutable bindingTo make an object’s values immutable, use
Object.freeze()
. It has been around since ES5 and is widely available nowadays.const foo = Object.freeze({ 'bar': 27 }); foo.bar = 42; // throws a TypeError exception in strict mode; // silently fails in sloppy mode