|
When copying an object copying IDs usually doesn't make sense. Also disabling enumeration for properties containing sensitive data may make a lot of sense. Writable and configurable Setting writableto falseprevents the property from being overwritten. It will still be possible to delete a given property and modify its descriptor. It is worth noting that attempting to overwrite a value will not result in an error unless the script is running in mode strict.
In this case an error will be thrown Cannot assign to read only property 'price' of object <Object>. const pineapple price pineapple 'price' . Attempts to extend the object with new properties will not cause errors. Enabling Phone Number List the mode strictwill cause an attempt to modify a frozen object to result in an error Cannot add property property_name object is not extensible. A similar effect will be achieved by trying to modify a frozen array.
Using the push and methods unshift .with the content Cannot add property object is not extensible. For arrays this behavior occurs regardless of whether the script is run in mode strictor not. The method differs Object.seal from Obje.freeze in that the properties of the object on which the method is invoked Object.seal are still modifiable. As with it Oe is not possible to extend an object and all properties are not configurable.
|
|