Reputation:
If I freeze a property similar to something below, is it possible to undo the changes later without having to recreate the object?
var obj = Object.freeze({foo:'can you add more properties later?', bee: {ahh: '?'}});
Object.defineProperty(obj.bee,'ehh',{value: 'can you change me later?'});
Upvotes: 1
Views: 431
Reputation: 769
No, when you freeze an object you're not able to change or add any property.
There is a function called Seal, that might be what you're looking for.
The Object.seal() method seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable.
Upvotes: 1