Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
3a071c9
fix typo
baooab Jan 20, 2020
4e4144b
fix: spell correction to existence
zeel Jan 21, 2020
5ea9b55
Update article.md
paroche Jan 22, 2020
f186b7c
Update article.md
paroche Jan 22, 2020
cae000f
Update article.md
paroche Jan 23, 2020
ff042a0
Merge pull request #1717 from zeel/typo/bug-object-fix
iliakan Jan 24, 2020
e85e48f
minor fixes
Violet-Bora-Lee Jan 27, 2020
4973824
Update article.md
Beginnerds Jan 28, 2020
a9f1dde
Merge pull request #1723 from Violet-Bora-Lee/master
iliakan Jan 28, 2020
bd6052f
Merge pull request #1715 from baooab/patch-4
iliakan Jan 28, 2020
6dbd306
Fixing a typo
sohailashraf003 Jan 29, 2020
c8b717e
Update article.md
paroche Jan 29, 2020
58205b3
Update article.md
paroche Jan 29, 2020
fbf76fe
Fix typo in 11-coordinates/article.md
devy-bee Jan 29, 2020
c498fc6
adding the `[^]` pattern
KennethKinLum Jan 29, 2020
05b0360
Merge pull request #1726 from sohailashraf003/patch-1
lex111 Jan 30, 2020
a035351
Merge pull request #1728 from hongsidev/master
iliakan Jan 30, 2020
6f7ec12
minor fixes
Violet-Bora-Lee Feb 1, 2020
d10b50a
Merge pull request #1732 from Violet-Bora-Lee/master
lex111 Feb 2, 2020
4b124fb
Update article.md
paroche Feb 3, 2020
b30915a
Merge pull request #1735 from javascript-tutorial/paroche-patch-13
paroche Feb 3, 2020
630b95e
Update article.md
paroche Feb 4, 2020
b28e9d9
Merge pull request #1736 from javascript-tutorial/paroche-patch-14
paroche Feb 4, 2020
a193448
Update article.md
paroche Feb 4, 2020
9927cd0
Update article.md
paroche Feb 4, 2020
d1a4550
Update article.md
paroche Feb 4, 2020
f9feec2
minor fixes
iliakan Feb 4, 2020
0081fbd
Merge pull request #1737 from javascript-tutorial/paroche-patch-15
iliakan Feb 5, 2020
5d4086e
Merge pull request #1729 from KennethKinLum/patch-8
iliakan Feb 5, 2020
3899cc0
minor fixes
iliakan Feb 5, 2020
81e9f17
minor fixes
iliakan Feb 5, 2020
0a2172a
Merge pull request #1725 from Beginnerds/patch-1
paroche Feb 5, 2020
6994fc0
Update article.md
paroche Feb 6, 2020
4d0ceef
Update article.md
paroche Feb 7, 2020
671c4d4
Update article.md
paroche Feb 7, 2020
537c334
Update article.md
paroche Feb 7, 2020
9a4bc89
Update article.md
paroche Feb 7, 2020
a06341b
Update article.md
paroche Feb 7, 2020
f47b732
Update article.md
paroche Feb 7, 2020
bd0fbf9
Update article.md
paroche Feb 7, 2020
c3213d3
Update article.md
paroche Feb 7, 2020
3fe2976
Update article.md
paroche Feb 7, 2020
3fc0a5d
Update article.md
paroche Feb 8, 2020
4a10b92
fix en #1739
iliakan Feb 8, 2020
bf8fe9f
Merge branch 'master' of https://github.com/iliakan/javascript-tutori…
iliakan Feb 8, 2020
e4fb777
minor fixes
iliakan Feb 8, 2020
d6035ee
Revert "minor fixes"
iliakan Feb 8, 2020
60d9fe6
Revert "Revert "minor fixes""
iliakan Feb 8, 2020
08720f0
Update article.md
paroche Feb 8, 2020
2fee345
Update article.md
paroche Feb 8, 2020
fd0d378
Update article.md
paroche Feb 9, 2020
10c7807
Update article.md
paroche Feb 9, 2020
cad5a28
Fix link in BigInt
lex111 Feb 10, 2020
bad7807
Grammar mistake (?)
Feb 10, 2020
bad9ca5
Update article.md
paroche Feb 11, 2020
59861ad
Update article.md
paroche Feb 11, 2020
0b2e5e7
Update article.md
paroche Feb 11, 2020
425a0af
Merge pull request #1745 from u-n-known/patch-1
lex111 Feb 11, 2020
00a1f2c
False precedence numbers
Feb 11, 2020
837f7ab
Update article.md
paroche Feb 12, 2020
3b681c8
Update article.md
paroche Feb 12, 2020
ff82a9b
Update article.md
paroche Feb 12, 2020
db9b580
closes #1747
iliakan Feb 12, 2020
42920c1
Update article.md
paroche Feb 12, 2020
62c32d2
Update article.md
paroche Feb 12, 2020
cb8c12c
Merge pull request #1746 from u-n-known/patch-2
iliakan Feb 12, 2020
863b320
Update article.md
paroche Feb 14, 2020
6cf0f08
Update article.md
paroche Feb 14, 2020
0b2cbf9
Update article.md
paroche Feb 14, 2020
1dd5e06
Update article.md
paroche Feb 14, 2020
220bed3
Update article.md
paroche Feb 14, 2020
7fb11bd
Update article.md
paroche Feb 14, 2020
c6c25c9
Update article.md
paroche Feb 14, 2020
1304aa1
Remove unnecessary return in couple of examples
nekhaevskiy Feb 14, 2020
9acc130
fixes #1747
iliakan Feb 14, 2020
2cd077c
Update article.md
rizkyzhang Feb 16, 2020
44a6c12
Fix typo
rizkyzhang Feb 16, 2020
5413a9c
fix: Minor typo and grammar
achianumba Feb 16, 2020
642b563
edited alice's wage difference, wage is based on the average of her m…
cycduck Feb 18, 2020
81def02
minor fixes
iliakan Feb 18, 2020
2437d3d
Merge pull request #1759 from cycduck/wage-gap-fix
iliakan Feb 18, 2020
6fa9659
Merge pull request #1756 from achianumba/patch-1
iliakan Feb 18, 2020
1c5b07c
Merge pull request #1755 from rizkyzhang/patch-3
iliakan Feb 18, 2020
323f155
Merge pull request #1754 from rizkyzhang/patch-2
iliakan Feb 18, 2020
233b0bd
Merge pull request #1752 from nekhaevskiy/patch-1
iliakan Feb 18, 2020
cedd3ed
closes #1742
iliakan Feb 19, 2020
d12903c
Mac OS multiline Commenting shortcut is should use 'Option' instead o…
nishantsinghcs Feb 19, 2020
016213e
Merge pull request #1760 from nishantsinghcs/patch-1
iliakan Feb 19, 2020
3e93486
closes #1758
iliakan Feb 20, 2020
188f497
"better to demonstrate" -> "best demonstrated", ", like this:" -> ":"
paroche Feb 21, 2020
2f066b4
Update article.md
bibin765 Feb 22, 2020
169389f
Some missing whitespaces
Feb 22, 2020
33c2a4e
Update article.md
leviding Feb 23, 2020
87d03ce
Merge pull request #1768 from leviding/patch-3
iliakan Feb 23, 2020
d0ad658
Merge pull request #1767 from u-n-known/patch-4
lex111 Feb 23, 2020
405150f
Merge pull request #1766 from bibin765/master
lex111 Feb 23, 2020
298a266
merging all conflicts
iliakan Feb 24, 2020
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/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ Kemampuan JavaScript yang ada di dalam browser terbatas demi keamanan pengguna.

Contoh keterbatasan tersebut meliputi:

<<<<<<< HEAD
- JavaScript pada halaman web tak boleh membaca/mengubah file semaunya pada hard disk, mengcopy script tersebut, atau mengeksekusi program. Ia tak punya akses langsung ke OS system functions.
=======
- JavaScript on a webpage may not read/write arbitrary files on the hard disk, copy them or execute programs. It has no direct access to OS functions.
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

Browser-browser modern memperbolehkan JavaScript mengakses file, tapi aksesnya dibatasi dan tersedia hanya jika pengguna melakukan hal tertentu, misalnya seperti "menjatuhkan" file ke dalam jendela browser atau memilih file via tag `<input>`.

Expand Down
9 changes: 9 additions & 0 deletions 1-js/02-first-steps/02-structure/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ Tapi itu harus jadi dua pernyataan terpisah, bukan satu. Penyatuan macam ini sal

Kami sarankan menaruh titik koma di antara pernyataan meski mereka dipisahkan garis baru. Ini aturan yang diterima secara luas oleh komunitas. Harap diingat sekali lagi bahwa -- *bisa saja* menanggalkan titik koma di banyak kesempatan. Tapi akan lebih aman -- terutama untuk pemula -- untuk menggunakan mereka.

<<<<<<< HEAD
## Komen
=======
## Comments [#code-comments]
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

Seiring waktu berjalan, program menjadi lebih rumit. Dan dibutuhkan *komen* yang menjelaskan kode apa itu dan kenapa.

Expand Down Expand Up @@ -135,8 +139,13 @@ alert('Hello');
alert('World');
```

<<<<<<< HEAD
```smart header="Gunakan hotkey!"
Di banyak editor, sebaris kode bisa dikomen dengan menekan hotkey `key:Ctrl+/` untuk komen baris-tunggal dan sesuatu macam `key:Ctrl+Shift+/` -- untuk komen multibaris (pilih sepotong kode dan tekan hotkeynya). Untuk Mac, coba `key:Cmd` ketimbang `key:Ctrl`.
=======
```smart header="Use hotkeys!"
In most editors, a line of code can be commented out by pressing the `key:Ctrl+/` hotkey for a single-line comment and something like `key:Ctrl+Shift+/` -- for multiline comments (select a piece of code and press the hotkey). For Mac, try `key:Cmd` instead of `key:Ctrl` and `key:Option` instead of `key:Shift`.
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46
```

````warn header="Komen bersarang tidak didukung!"
Expand Down
13 changes: 13 additions & 0 deletions 1-js/02-first-steps/07-operators/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,30 @@ Di sini adalah extrak dari [tabel presedensi](https://developer.mozilla.org/en/J
| Presedensi | Nama | Tanda |
|------------|------|------|
| ... | ... | ... |
<<<<<<< HEAD
| 16 | plus unary | `+` |
| 16 | negasi unary | `-` |
| 14 | perkalian | `*` |
| 14 | pembagian | `/` |
| 13 | penambahan | `+` |
| 13 | pengurangan | `-` |
=======
| 17 | unary plus | `+` |
| 17 | unary negation | `-` |
| 15 | multiplication | `*` |
| 15 | division | `/` |
| 13 | addition | `+` |
| 13 | subtraction | `-` |
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46
| ... | ... | ... |
| 3 | penetapan | `=` |
| ... | ... | ... |

<<<<<<< HEAD
Seperti yang kita lihat, "plus unary" punya prioritas `16` yang lebih tinggi dari `13` "penambahan" (plus binary). Itulah kenapa, dalam expresi `"+apples + +oranges"`, plus unary bekerja sebelum penambahan.
=======
As we can see, the "unary plus" has a priority of `17` which is higher than the `13` of "addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

## Penetapan

Expand Down
6 changes: 5 additions & 1 deletion 1-js/02-first-steps/12-while-for/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Untuk nilai genap dari `i`, perintah `continue` mengentikan menjalankan badan da
````smart header="Perintah `continue` membantu mengurangi penyarangan"
Sebuah perulangan yang menampilkan nilai ganjil dapat terlihat seperti ini:

```js
```js run
for (let i = 0; i < 10; i++) {

if (i % 2) {
Expand All @@ -268,7 +268,11 @@ for (let i = 0; i < 10; i++) {

Dari sudut pandang teknis, ini identik dengan contoh diatas. Tentunya, kita dapat membungkus kode dalam sebuah blok `if` daripada menggunakan `continue`.

<<<<<<< HEAD
Tapi efek sampinya, ini membuat penyarangan satu level lebih (`alert` dipanggil didalam kurung kurawal). Jika kode didalam `if` lebih panjang dari beberapa baris, itu mungkin mengurangi keterbacaan keseluruhan.
=======
But as a side-effect, this created one more level of nesting (the `alert` call inside the curly braces). If the code inside of `if` is longer than a few lines, that may decrease the overall readability.
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46
````

````warn header="Tidak ada `break/continue` ke sisi kanan '?'"
Expand Down
2 changes: 1 addition & 1 deletion 1-js/03-code-quality/02-coding-style/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Misalnya:
```js
// backtick quote ` memperbolehkan memecah string jadi beberapa baris
let str = `
Ecma International's TC39 is a group of JavaScript developers,
ECMA International's TC39 is a group of JavaScript developers,
implementers, academics, and more, collaborating with the community
to maintain and evolve the definition of JavaScript.
`;
Expand Down
75 changes: 75 additions & 0 deletions 1-js/04-object-basics/01-object/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ Untuk properti multi-kata, akses dot tak bekerja:
user.likes birds = true
```

<<<<<<< HEAD
Ini karena dot mensyaratkan key merupakan identifier variabel yang valid. Yaitu: tak ada spasi dan limitasi lain.
=======
JavaScript doesn't understand that. It thinks that we address `user.likes`, and then gives a syntax error when comes across unexpected `birds`.

The dot requires the key to be a valid variable identifier. That implies: contains no spaces, doesn't start with a digit and doesn't include special characters (`$` и `_` are allowed).
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

Ada alternatif "notasi bracket kotak" yang bekerja dengan string apapun:

Expand Down Expand Up @@ -203,6 +209,7 @@ Bracket kotak jauh lebih kuat dari notasi dot. Mereka membolehkan variabel dan n

Jadi seringnya, saat nama properti diketahui dan simpel, dot dipakai. Dan jika kita butuh sesuatu yang rumit, maka kita ganti ke bracket kotak.

<<<<<<< HEAD


````smart header="Kata khusus dibolehkan sebagai nama properti"
Expand Down Expand Up @@ -241,6 +248,9 @@ Ada juga struktur data lain [Map](info:map-set), yang akan kita pelajari di bab


## Steno nilai properti
=======
## Property value shorthand
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

Di kode riil kita sering memakai variabel sebagai nilai untuk nama properti.

Expand Down Expand Up @@ -284,7 +294,67 @@ let user = {
};
```

<<<<<<< HEAD
## Cek existensi
=======
## Property names limitations

Property names (keys) must be either strings or symbols (a special type for identifiers, to be covered later).

Other types are automatically converted to strings.

For instance, a number `0` becomes a string `"0"` when used as a property key:

```js run
let obj = {
0: "test" // same as "0": "test"
};

// both alerts access the same property (the number 0 is converted to string "0")
alert( obj["0"] ); // test
alert( obj[0] ); // test (same property)
```

**Reserved words are allowed as property names.**

As we already know, a variable cannot have a name equal to one of language-reserved words like "for", "let", "return" etc.

But for an object property, there's no such restriction. Any name is fine:

```js run
let obj = {
for: 1,
let: 2,
return: 3
};

alert( obj.for + obj.let + obj.return ); // 6
```

We can use any string as a key, but there's a special property named `__proto__` that gets special treatment for historical reasons.

For instance, we can't set it to a non-object value:

```js run
let obj = {};
obj.__proto__ = 5; // assign a number
alert(obj.__proto__); // [object Object] - the value is an object, didn't work as intended
```

As we see from the code, the assignment to a primitive `5` is ignored.

The nature of `__proto__` will be revealed in detail later in the chapter [](info:prototype-inheritance).

As for now, it's important to know that such behavior of `__proto__` can become a source of bugs and even vulnerabilities if we intend to store user-provided keys in an object.

The problem is that a visitor may choose `__proto__` as the key, and the assignment logic will be ruined (as shown above).

There are two workarounds for the problem:
1. Modify the object's behavior to treat `__proto__` as a regular property. We'll learn how to do it in the chapter [](info:prototype-methods).
2. Using [Map](info:map-set) data structure which supports arbitrary keys. We'll learn it in the chapter <info:map-set>.

## Property existence test, "in" operator
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

Satu fitur objek penting ialah kita bisa melakukan akses ke properti. Takkan ada galat jika properti tak ada! Mengakses properti yang tak ada hanya mengembalikan `undefined`. Ia menyediakan cara paling umum untuk mengetes existensi properti -- mengambilnya dan membandingan dengan undefined:

Expand Down Expand Up @@ -321,8 +391,13 @@ let key = "age";
alert( *!*key*/!* in user ); // true, mengambil nama dari kunci dan mengecek properti tersebut
```

<<<<<<< HEAD
````smart header="Menggunakan \"in\" untuk properti yang menyimpan `undefined`"
Biasanya, pembandingan ketat `"=== undefined"` mengecek existensi properti dengan baik. Tapi ada kasus spesial saat ia gagal, tapi `"in"` bekerja dengan benar.
=======
````smart header="Using \"in\" for properties that store `undefined`"
Usually, the strict comparison `"=== undefined"` check the property existence just fine. But there's a special case when it fails, but `"in"` works correctly.
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

Itu ialah saat ada properti objek, tapi menyimpan `undefined`:

Expand Down
13 changes: 13 additions & 0 deletions 1-js/04-object-basics/03-symbol/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ let id = Symbol();

Selama penyusunan, kita bisa memberikan simbol sebuah deskripsi (juga disebut sebagai nama simbol), kebanyakan berguna untuk tujuan-tujuan *debugging*:

<<<<<<< HEAD
```js run
// id adalah sebuah simbol dengan deskripsi "id"
=======
```js
// id is a symbol with the description "id"
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46
let id = Symbol("id");
```

Expand Down Expand Up @@ -178,6 +183,7 @@ alert( clone[id] ); // 123

Tidak ada paradoks di sini. Hal itu sesuai rancangan. Gagasan bahwa ketika kita meng-*clone* sebuah objek atau menyatukan (*merge*) objek-objek, kita biasanya ingin *semua* properti disalin (termasuk simbol seperti `id`).

<<<<<<< HEAD
````smart header="Properti-properti kunci dari tipe lain dipaksa menjadi string"
Kita hanya bisa menggunakan string atau simbol sebagai kunci dalam objek. Tipe-tipe lain dikonversi menjadi string.

Expand All @@ -195,6 +201,9 @@ alert( obj[0] ); // tes (properti yang sama)
````

## Simbol-simbol global
=======
## Global symbols
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

Seperti yang kita lihat, biasanya semua simbol itu berbeda, bahkan jika simbol-simbol tersebut memiliki nama yang sama. Tapi terkadang kita ingin simbol yang bernama sama untuk menjadi barang yang sama pula. Sebagai contoh, bagian-bagian lain dari aplikasi kita ingin mengakses simbol `"id"` yang berarti properti yang sama pula.

Expand Down Expand Up @@ -241,7 +250,11 @@ alert( Symbol.keyFor(sym) ); // name
alert( Symbol.keyFor(sym2) ); // id
```

<<<<<<< HEAD
`Symbol.keyFor` secara internal menggunakan catatan simbol global untuk mencari kunci (*key*) untuk sebuah simbol. Jadi ini tidak bekerja untuk simbol-simbol non-global. Jika simbol tersebut tidak global, simbol tersebut tidak bisa ditemukan dan akan mengembalikan `undefined`.
=======
The `Symbol.keyFor` internally uses the global symbol registry to look up the key for the symbol. So it doesn't work for non-global symbols. If the symbol is not global, it won't be able to find it and returns `undefined`.
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

Seperti yang dikatakan, simbol apapun memiliki properti `description`.

Expand Down
4 changes: 4 additions & 0 deletions 1-js/04-object-basics/04-object-methods/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ user.sayHi(); // Hello!
```smart header="Object-oriented programming"
Ketika kita menulis kode kita menggunakan objek-objek untuk merepresentasikan benda, itulah yang disebut sebagai [object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming), disingkat menjadi: "OOP".

<<<<<<< HEAD
OOP itu adalah sebuah pembahasan besar, ilmu yang menarik dari dirinya sendiri. Bagaimana cara memilih (perwujudan) benda yang benar? Bagaimana cara mengatur interaksi di antara benda-benda tersebut? Itulah arsitektur, dan literatur-literatur yang lebih besar lagi tentang topik tersebut, like "Design Patterns: Elements of Reusable Object-Oriented Software" oleh E.Gamma, R.Helm, R.Johnson, J.Vissides atau "Object-Oriented Analysis and Design with Applications" oleh G.Booch, dan masih banyak lagi.
=======
OOP is a big thing, an interesting science of its own. How to choose the right entities? How to organize the interaction between them? That's architecture, and there are great books on that topic, like "Design Patterns: Elements of Reusable Object-Oriented Software" by E. Gamma, R. Helm, R. Johnson, J. Vissides or "Object-Oriented Analysis and Design with Applications" by G. Booch, and more.
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46
```
### Metode ringkas

Expand Down
4 changes: 4 additions & 0 deletions 1-js/05-data-types/03-string/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,11 @@ Algoritma yang "benar" untuk melakukan perbandingan string lebih kompleks dari k

Jadi, browser harus tahu bahasa yang digunakan untuk perbandingan.

<<<<<<< HEAD
Beruntungnya, semua browser modern (IE10- memerlukan library tambahan [Intl.JS](https://github.com/andyearnshaw/Intl.js/)) mendukung standar internasionalisasi [ECMA 402](http://www.ecma-international.org/ecma-402/1.0/ECMA-402.pdf).
=======
Luckily, all modern browsers (IE10- requires the additional library [Intl.js](https://github.com/andyearnshaw/Intl.js/)) support the internationalization standard [ECMA-402](http://www.ecma-international.org/ecma-402/1.0/ECMA-402.pdf).
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

Hal tersebut menyediakan cara spesial untuk membandingkan stringi di berbeda bahasa, mengikuti peraturan mereka.

Expand Down
16 changes: 10 additions & 6 deletions 1-js/05-data-types/04-array/10-maximal-subarray/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ Tugasnya adalah: menemukan *subarray* `arr` yang berdampingan dengan nilai maksi

Tulis fungsi `getMaxSubSum(arr)` yang akan mengembalikan nilai penjumlahan tersebut.

<<<<<<< HEAD
Sebagai contoh:
=======
For instance:
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

```js
getMaxSubSum([-1, *!*2, 3*/!*, -9]) = 5 (the sum of highlighted items)
getMaxSubSum([*!*2, -1, 2, 3*/!*, -9]) = 6
getMaxSubSum([-1, 2, 3, -9, *!*11*/!*]) = 11
getMaxSubSum([-2, -1, *!*1, 2*/!*]) = 3
getMaxSubSum([*!*100*/!*, -9, 2, -3, 5]) = 100
getMaxSubSum([*!*1, 2, 3*/!*]) = 6 (take all)
getMaxSubSum([-1, *!*2, 3*/!*, -9]) == 5 (the sum of highlighted items)
getMaxSubSum([*!*2, -1, 2, 3*/!*, -9]) == 6
getMaxSubSum([-1, 2, 3, -9, *!*11*/!*]) == 11
getMaxSubSum([-2, -1, *!*1, 2*/!*]) == 3
getMaxSubSum([*!*100*/!*, -9, 2, -3, 5]) == 100
getMaxSubSum([*!*1, 2, 3*/!*]) == 6 (take all)
```

Jika semua *item* adalah negatif, hal tersebut berarti kita tidak mengambil apapun (*subarray* kosong), jadi jumlahnya sama dengan nol:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let users = [
let usersById = groupById(users);

/*
// after the call we have:
// after the call we should have:

usersById = {
john: {id: 'john', name: "John Smith", age: 20}
Expand Down
4 changes: 2 additions & 2 deletions 1-js/05-data-types/06-iterable/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If an object isn't technically an array, but represents a collection (list, set)

We can easily grasp the concept of iterables by making one of our own.

For instance, we have an object, that is not an array, but looks suitable for `for..of`.
For instance, we have an object that is not an array, but looks suitable for `for..of`.

Like a `range` object that represents an interval of numbers:

Expand Down Expand Up @@ -294,7 +294,7 @@ Objects that can be used in `for..of` are called *iterable*.

- Technically, iterables must implement the method named `Symbol.iterator`.
- The result of `obj[Symbol.iterator]` is called an *iterator*. It handles the further iteration process.
- An iterator must have the method named `next()` that returns an object `{done: Boolean, value: any}`, here `done:true` denotes the iteration end, otherwise the `value` is the next value.
- An iterator must have the method named `next()` that returns an object `{done: Boolean, value: any}`, here `done:true` denotes the end of the iteration process, otherwise the `value` is the next value.
- The `Symbol.iterator` method is called automatically by `for..of`, but we also can do it directly.
- Built-in iterables like strings or arrays, also implement `Symbol.iterator`.
- String iterator knows about surrogate pairs.
Expand Down
1 change: 0 additions & 1 deletion 1-js/05-data-types/08-weakmap-weakset/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ And here's another part of the code, maybe another file using it:
let john = { name: "John" };

countUser(john); // count his visits
countUser(john);

// later john leaves us
john = null;
Expand Down
6 changes: 3 additions & 3 deletions 1-js/06-advanced-functions/01-recursion/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ let company = {
salary: 1000
}, {
name: 'Alice',
salary: 600
salary: 1600
}],

development: {
Expand Down Expand Up @@ -350,7 +350,7 @@ The algorithm is probably even easier to read from the code:

```js run
let company = { // the same object, compressed for brevity
sales: [{name: 'John', salary: 1000}, {name: 'Alice', salary: 600 }],
sales: [{name: 'John', salary: 1000}, {name: 'Alice', salary: 1600 }],
development: {
sites: [{name: 'Peter', salary: 2000}, {name: 'Alex', salary: 1800 }],
internals: [{name: 'Jack', salary: 1300}]
Expand All @@ -372,7 +372,7 @@ function sumSalaries(department) {
}
*/!*

alert(sumSalaries(company)); // 6700
alert(sumSalaries(company)); // 7700
```

The code is short and easy to understand (hopefully?). That's the power of recursion. It also works for any level of subdepartment nesting.
Expand Down
4 changes: 4 additions & 0 deletions 1-js/06-advanced-functions/03-closure/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,11 @@ let arr = [f(), f(), f()];

Sebuah objek lingkungan leksikal mati apabila sudah tidak dapat dicapai (sperti objek lainnya). Dengan kata lain, objek tersebut hidup selama masih ada setidaknya satu fungsi bersarang yang mengacunya.

<<<<<<< HEAD
Di kode berikut, setelah fungsi bersarang itu dihapus, Lingkungan Lexikal lingkupannya (serta `value`-nya) dibersihkan dari memori;
=======
In the code below, after the nested function is removed, its enclosing Lexical Environment (and hence the `value`) is cleaned from memory:
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

```js
function f() {
Expand Down
4 changes: 4 additions & 0 deletions 1-js/06-advanced-functions/04-var/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ Orang-orang juga menyebut perilaku seperti ini "hoisting", karena semua `var` "h
Sehingga dalam contoh di atas, cabang `if (false)` tidak pernah dijalankan, tetapi itu tidak masalah. `var` di dalamnya diproses di awal fungsi, jadi pada saat `(*)` variabel ada.
**Pendeklarasian hoisted, sedangkan penugasan (assigment) tidak.**

<<<<<<< HEAD
Lebih baik mendemonstrasikan dengan contoh, seperti ini:
=======
That's best demonstrated with an example:
>>>>>>> 405150f1f286db19a3c1ed913fa3e905fcefbe46

```js run
function sayHi() {
Expand Down
Loading