Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/08-operators/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,11 @@ Daftar operator:
- RIGHT SHIFT ( `>>` )
- ZERO-FILL RIGHT SHIFT ( `>>>` )

<<<<<<< HEAD
Operator seperti diatas sangat jarang digunakan, ketika kita membutuhkan untuk memainkan angka di level paling rendah (bitwise). Kita tidak akan membutuhkan operator seperti ini dalam waktu dekat, sebagaimana dalam pengembangan web penggunaan operator seperti itu lebih sedikit, tetapi di area yang spesial, seperti kriptographi, operator seperti itu sangan dibutuhkan. Kamu bisa membaca artikel [Bitwise Operators](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators) di MDN ketika kamu membutuhkannya.
=======
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.
>>>>>>> e074a5f825a3d10b0c1e5e82561162f75516d7e3

## Koma

Expand Down
42 changes: 40 additions & 2 deletions 1-js/07-object-properties/01-property-descriptors/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,46 @@ Tepatnya, non-configurable memberlakukan beberapa pembatasan pada `definePropert
3. tidak bisa mengubah `writable: false` menjadi `true` (kebalikannya masih bisa bekerja).
4. tidak bisa mengubah `get/set` untuk sebuah properti aksesor (tapi bisa menetapkannya jika kosong).

<<<<<<< HEAD
Disini kita membuat `user.name` menjadi sebuah konstant "yang selamanya tersegel":
=======
To be precise, non-configurability imposes several restrictions on `defineProperty`:
1. Can't change `configurable` flag.
2. Can't change `enumerable` flag.
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).

**The idea of "configurable: false" is to prevent changes of property flags and its deletion, while allowing to change its value.**

Here `user.name` is non-configurable, but we can still change it (as it's writable):
>>>>>>> e074a5f825a3d10b0c1e5e82561162f75516d7e3

```js run
let user = { };
let user = {
name: "John"
};

Object.defineProperty(user, "name", {
configurable: false
});

user.name = "Pete"; // works fine
delete user.name; // Error
```

And here we make `user.name` a "forever sealed" constant:

```js run
let user = {
name: "John"
};

Object.defineProperty(user, "name", {
value: "John",
writable: false,
configurable: false
});

<<<<<<< HEAD
*!*
// tidak bisa mengubah user.name atau flag nya
// semua dibawah ini tidak akan bekerja:
Expand All @@ -254,6 +283,15 @@ Catatan pengecualian: sebuah nilai dari non-configurable, tapi writable properti

Ide dari `configurable: false` adalah untuk mencegah perubahan properti flag dan penghapusannya, bukan perubahan dalam nilainya.
```
=======
// won't be able to change user.name or its flags
// all this won't work:
user.name = "Pete";
delete user.name;
Object.defineProperty(user, "name", { value: "Pete" });
```

>>>>>>> e074a5f825a3d10b0c1e5e82561162f75516d7e3

## Object.defineProperties

Expand Down