What is the result of this code? const obj = { a: 1 }; Object.freeze(obj); obj.a = 2; console.log(obj.a);
Key points
- Object.freeze prevents property modification.
- Non-strict mode results in silent failure.
- Strict mode throws an error on modification.
- Freezing is shallow by default.
Ready to go further?
