
Object.freeze() – Freezes an object: prevents adding/removing properties and makes existing properties immutable.
๐ Syntax
Object.freeze(obj)
๐งช Example
const config = { debug: true };
Object.freeze(config);
config.debug = false;
console.log(config.debug); // true
Comments
Post a Comment