closes #1309
This commit is contained in:
parent
08a9560166
commit
15f8b887f1
1 changed files with 8 additions and 2 deletions
|
@ -227,8 +227,6 @@ To be precise, non-configurability imposes several restrictions on `defineProper
|
|||
3. Can't change `writable: false` to `true` (the other way round works).
|
||||
4. Can't change `get/set` for an accessor property (but can assign them if absent).
|
||||
|
||||
Notable exception: a value of non-configurable, but writable property still can be changed.
|
||||
|
||||
Here we are making `user.name` a "forever sealed" constant:
|
||||
|
||||
```js run
|
||||
|
@ -250,6 +248,14 @@ Object.defineProperty(user, "name", {writable: true}); // Error
|
|||
*/!*
|
||||
```
|
||||
|
||||
```smart header="Non-configurable doesn't mean \"non-writable\""
|
||||
Notable exception: a value of non-configurable, but writable property can be changed.
|
||||
|
||||
The idea of `configurable: false` is to prevent changes to property flags and its deletion, not changes to its value.
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Object.defineProperties
|
||||
|
||||
There's a method [Object.defineProperties(obj, descriptors)](mdn:js/Object/defineProperties) that allows to define many properties at once.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue