In JavaScript, you can define a readonly property. However, if I try to redefine the value of such a property, nothing happens. The value remains the same, but the exception is not thrown.
Code example:
var obj = {}; Object.defineProperty(obj, 'val', { writable: false, value: 'foo' }); obj.val = 'bar'; console.log(obj.val); // Выведет 'foo'; Why is this happening, and how to ensure that such errors are not hushed up?