Write a function `freezeObject(obj)` that freezes the object and returns true if it is frozen.
Problem Statement
Write a function `freezeObject(obj)` that freezes the object and returns true if it is frozen.
Complexity
Time Complexity: -
Space Complexity: -
Hints
š” Hint 1:
Object.freeze() prevents modifications to an object.
š” Hint 2:
Object.isFrozen() checks if an object is frozen.
š” Hint 3:
Object.freeze(obj); return Object.isFrozen(obj);
ā
Solution:
```javascript
function freezeObject(obj) {
Object.freeze(obj);
return Object.isFrozen(obj);
}
```