Performs a deep freeze on an object, making all its properties immutable. This function recursively calls itself on all nested objects, ultimately ensuring that all properties are read-only.
The object to be frozen
The frozen object
const obj = { a: 1, b: { c: 2 } };const frozenObj = deepFreeze(obj);frozenObj.b.c = 3; // TypeError: Cannot assign to read only property 'c' Copy
const obj = { a: 1, b: { c: 2 } };const frozenObj = deepFreeze(obj);frozenObj.b.c = 3; // TypeError: Cannot assign to read only property 'c'
Performs a deep freeze on an object, making all its properties immutable. This function recursively calls itself on all nested objects, ultimately ensuring that all properties are read-only.