Object.freezebeginner// Make an object immutable
const obj = Object.freeze({ x: 1 })
obj.x = 99 // silently ignored
obj.x // β 1Use Object.freeze() to make an object immutable, preventing any additions, deletions, or value changes.
After freezing, you cannot add new properties to an object. In non-strict mode this fails silently.
Challenge: Implement tryAddToFrozen() that creates a frozen object { a: 1 }, tries to add b: 2, and returns the object's key count.
tryAddToFrozen() // β 1 (only 'a', 'b' was not added)