It is possible to make a non extensible object extensible ?
var obj = {};
Object.preventExtensions(obj);
obj.abc = "abc"; // this line is ignored which is normal
//is there a way to make obj extensible again
How about a deep clone?
obj = JSON.parse(JSON.stringify(obj));
obj.abc = "abc"; // this line is now OK
Is OK in local code but any external references that came with obj will no longer point to the newly formed obj.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With