Maizere Pathak.Nepal
Maizere Pathak.Nepal

Reputation: 2411

Preventing extension of object in Javascript

preventExtensions() method prevents extensible object from extending, isn't there way to redo it? Or isn't there a method or trick to convert non-extensible object to extensible object. I wanted to know whether it is possible or not.

Upvotes: 1

Views: 315

Answers (1)

imsky
imsky

Reputation: 3289

No. You can still modify the prototype, but not the object itself.

From MDN @ https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/preventExtensions:

If there is a way to turn an extensible object to a non-extensible one, there is no way to do the opposite in ECMAScript 5

Upvotes: 1

Related Questions