Skip to content

Commit 614c85a

Browse files
committed
minor fixes
1 parent df215cd commit 614c85a

File tree

1 file changed

+5
-6
lines changed
  • 1-js/07-object-properties/01-property-descriptors

1 file changed

+5
-6
lines changed

1-js/07-object-properties/01-property-descriptors/article.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,6 @@ Math.PI = 3; // Error
221221

222222
Making a property non-configurable is a one-way road. We cannot change it back with `defineProperty`.
223223

224-
To be precise, non-configurability imposes several restrictions on `defineProperty`:
225-
1. Can't change `configurable` flag.
226-
2. Can't change `enumerable` flag.
227-
3. Can't change `writable: false` to `true` (the other way round works).
228-
4. Can't change `get/set` for an accessor property (but can assign them if absent).
229-
230224
**The idea of "configurable: false" is to prevent changes of property flags and its deletion, while allowing to change its value.**
231225

232226
Here `user.name` is non-configurable, but we can still change it (as it's writable):
@@ -263,6 +257,11 @@ delete user.name;
263257
Object.defineProperty(user, "name", { value: "Pete" });
264258
```
265259

260+
```smart header="The only attribute change possible: writable true -> false"
261+
There's a minor exception, that we have to mention.
262+
263+
We can change `writable: true` to `false` for a non-configurable property, thus making the property readonly (can add another layer of protection). But not the other way around.
264+
```
266265

267266
## Object.defineProperties
268267

0 commit comments

Comments
 (0)