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.
Object.freeze(obj) makes an object immutable: you cannot add, remove, or change its properties. In non-strict mode, modifications silently fail.
Challenge: Implement freezeObj(obj) that freezes obj and returns it.
const o = freezeObj({ a: 1 })
o.a = 99 // silently fails
o.a // β 1