js
Object.freeze(obj)في strict mode المحاولة بترمي TypeError، ومن غيرها بتفشل في صمت. عشان تجمّد المتداخل كمان لازم تلف على كل حاجة جوه بنفسك.
البرهان
js
const config = Object.freeze({ retries: 3, nested: { n: 1 } });
try { config.retries = 99; } catch (e) { console.log(e.name); }
config.nested.n = 2;
console.log(config.retries, config.nested.n, Object.isFrozen(config));النتيجة
TypeError 3 2 true