Skip to content

Commit e1efdf7

Browse files
committed
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-e074a5f8
2 parents c2c5fcd + e074a5f commit e1efdf7

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

1-js/02-first-steps/08-operators/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ The list of operators:
428428
- RIGHT SHIFT ( `>>` )
429429
- ZERO-FILL RIGHT SHIFT ( `>>>` )
430430
431-
These operators are used very rarely, when we need to fiddle with numbers on the very lowest (bitwise) level. We won't need these operators any time soon, as web development has little use of them, but in some special areas, such as cryptography, they are useful. You can read the [Bitwise Operators](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators) article on MDN when a need arises.
431+
These operators are used very rarely, when we need to fiddle with numbers on the very lowest (bitwise) level. We won't need these operators any time soon, as web development has little use of them, but in some special areas, such as cryptography, they are useful. You can read the [Bitwise Operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Bitwise) chapter on MDN when a need arises.
432432

433433
## Comma
434434

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,32 +227,42 @@ To be precise, non-configurability imposes several restrictions on `defineProper
227227
3. Can't change `writable: false` to `true` (the other way round works).
228228
4. Can't change `get/set` for an accessor property (but can assign them if absent).
229229

230-
Here we are making `user.name` a "forever sealed" constant:
230+
**The idea of "configurable: false" is to prevent changes of property flags and its deletion, while allowing to change its value.**
231+
232+
Here `user.name` is non-configurable, but we can still change it (as it's writable):
231233

232234
```js run
233-
let user = { };
235+
let user = {
236+
name: "John"
237+
};
238+
239+
Object.defineProperty(user, "name", {
240+
configurable: false
241+
});
242+
243+
user.name = "Pete"; // works fine
244+
delete user.name; // Error
245+
```
246+
247+
And here we make `user.name` a "forever sealed" constant:
248+
249+
```js run
250+
let user = {
251+
name: "John"
252+
};
234253

235254
Object.defineProperty(user, "name", {
236-
value: "John",
237255
writable: false,
238256
configurable: false
239257
});
240258

241-
*!*
242259
// won't be able to change user.name or its flags
243260
// all this won't work:
244-
// user.name = "Pete"
245-
// delete user.name
246-
// Object.defineProperty(user, "name", { value: "Pete" })
247-
Object.defineProperty(user, "name", {writable: true}); // Error
248-
*/!*
261+
user.name = "Pete";
262+
delete user.name;
263+
Object.defineProperty(user, "name", { value: "Pete" });
249264
```
250265

251-
```smart header="\"Non-configurable\" doesn't mean \"non-writable\""
252-
Notable exception: a value of non-configurable, but writable property can be changed.
253-
254-
The idea of `configurable: false` is to prevent changes to property flags and its deletion, not changes to its value.
255-
```
256266

257267
## Object.defineProperties
258268

0 commit comments

Comments
 (0)