Explorer
Node.js

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); } ```

Object.freeze and Immutability

Easy
Write a function `freezeObject(obj)` that freezes the object and returns true if it is frozen.
Editor
Loading Editor...
Evaluate code
Output:Click "Run" above to execute and verify your code here.
true