Skip to content

Commit d2f5915

Browse files
committed
merging all conflicts
2 parents 2fcbb0b + 6ab384f commit d2f5915

File tree

69 files changed

+743
-151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+743
-151
lines changed

1-js/01-getting-started/2-manuals-specifications/article.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ Versi spesifikasi baru dirilis tiap tahun. Di antara rilis ini, draft spesifikas
1313

1414
Untuk membaca tentang fitur terkini, termasuk yang "hampir menjadi standar" (disebut "stage 3"), lihat proposalnya di <https://github.com/tc39/proposals>.
1515

16+
<<<<<<< HEAD
1617
Juga, jika kamu dalam pengembangan untuk peramban, maka ada spek lain yang dibahas di [bagian kedua](info:browser-environment) di tutorial ini.
18+
=======
19+
Also, if you're developing for the browser, then there are other specifications covered in the [second part](info:browser-environment) of the tutorial.
20+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
1721
1822
## Manual
1923

1-js/01-getting-started/4-devtools/article.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ Supaya bisa melihat error dan memperoleh informasi berfaedah lainnya dari script
88

99
Kebanyakan pengembang memakai Chrome atau Firefox untuk pengembangan karena tools pengembangan yang mereka punya paling mantap. Peramban lain punya juga koq, ada with special features, but are usually playing "catch-up" to Chrome or Firefox. So most developers have a "favorite" browser and switch to others if a problem is browser-specific.
1010

11+
<<<<<<< HEAD
1112
Tools pengembang mengandung faedah; mereka punya banyak fitur. Untuk memulainya, kita akan belajar cara membuka mereka, mencari error, dan menjalankan perintah JavaScript.
13+
=======
14+
Developer tools are potent; they have many features. To start, we'll learn how to open them, look at errors, and run JavaScript commands.
15+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
1216
1317
## Google Chrome
1418

1-js/02-first-steps/08-operators/3-primitive-conversions-questions/solution.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ true + false = 1
99
"$" + 4 + 5 = "$45"
1010
"4" - 2 = 2
1111
"4px" - 2 = NaN
12-
7 / 0 = Infinity
1312
" -9 " + 5 = " -9 5" // (3)
1413
" -9 " - 5 = -14 // (4)
1514
null + 1 = 1 // (5)

1-js/02-first-steps/08-operators/3-primitive-conversions-questions/task.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ true + false
1616
"$" + 4 + 5
1717
"4" - 2
1818
"4px" - 2
19-
7 / 0
2019
" -9 " + 5
2120
" -9 " - 5
2221
null + 1

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,35 @@ alert( 8 % 3 ); // 2, sisa dari pembagian antara 8 dibagi 3
5656

5757
### Eksponensial **
5858

59+
<<<<<<< HEAD
5960
Operator eksponensial `a ** b` mengkalikan `a` dengan nilai itu sendiri sebanyak `b` kali.
61+
=======
62+
The exponentiation operator `a ** b` raises `a` to the power of `b`.
63+
64+
In school maths, we write that as a<sup>b</sup>.
65+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
6066

6167
Contoh:
6268

6369
```js run
70+
<<<<<<< HEAD
6471
alert( 2 ** 2 ); // 4 (2 dikalikan dengan nilai itu sendiri sebanyak 2 kali)
6572
alert( 2 ** 3 ); // 8 (2 * 2 * 2, 3 kali)
6673
alert( 2 ** 4 ); // 16 (2 * 2 * 2 * 2, 4 kali)
6774
```
6875

6976
Secara matematis, eksponensial juga bisa digunakan untuk nomor yang bukan integer.
7077
Contoh, akar kuadrat adalah eksponen dari `1/2`:
78+
=======
79+
alert( 2 ** 2 ); // 2² = 4
80+
alert( 2 ** 3 ); // 2³ = 8
81+
alert( 2 ** 4 ); // 2⁴ = 16
82+
```
83+
84+
Just like in maths, the exponentiation operator is defined for non-integer numbers as well.
85+
86+
For example, a square root is an exponentiation by ½:
87+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
7188
7289
```js run
7390
alert( 4 ** (1/2) ); // 2 (pangkat 1/2 sama dengan akar kuadrat)

1-js/02-first-steps/10-ifelse/2-check-standard/task.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ Nilai penting: 2
66

77
Dengan menggunakan konstruksi `if..else`, tulis kode yang menanyakan: 'Apa nama "official" JavaScript?'
88

9+
<<<<<<< HEAD
910
Jika pengunjung memasukkan "ECMAScript", maka tunjukkan output "Benar!", Jika tidak - tunjukkan output: "Tidak tahu? ECMAScript!"
11+
=======
12+
If the visitor enters "ECMAScript", then output "Right!", otherwise -- output: "You don't know? ECMAScript!"
13+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
1014
1115
![](ifelse_task2.svg)
1216

1-js/02-first-steps/11-logical-operators/article.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Operator logika
22

3+
<<<<<<< HEAD
34
Ada tiga operator logika di JavaScript: `||` (OR), `&&` (AND), `!` (NOT).
5+
=======
6+
There are four logical operators in JavaScript: `||` (OR), `&&` (AND), `!` (NOT), `??` (Nullish Coalescing). Here we cover the first three, the `??` operator is in the next article.
7+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
48
59
Meski mereka dipanggil "logika", mereka bisa diaplikasikan ke nilai tipe apapun, bukan cuma boolean. Hasil mereka bisa juga tipe apapun.
610

@@ -64,7 +68,11 @@ if (hour < 10 || hour > 18 || isWeekend) {
6468
}
6569
```
6670

71+
<<<<<<< HEAD
6772
## OR "||" mencari nilai truthy pertama
73+
=======
74+
## OR "||" finds the first truthy value [#or-finds-the-first-truthy-value]
75+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
6876
6977
Logika di atas memang klasik. Sekarang, mari bawa fitur "extra" JavaScript.
7078

1-js/02-first-steps/12-nullish-coalescing-operator/article.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[recent browser="new"]
44

5+
<<<<<<< HEAD
56
Disini, didalam artikel ini, kita bisa mengatakan sebuah ekspresi telah "didefinisikan" ketika nilainya bukanlah `null` ataupun `undefined`.
67

78
Operator penggabungan nullish ditulis sebagai dua tanda tanya `??`.
@@ -14,6 +15,16 @@ Hasil dari `a ?? b` adalah:
1415
<<<<<<< HEAD
1516
Dengan kata lain, `??` mengembalikan argumen pertama jika argumen tersebut telah didefinisikan. Sebaliknya, mengembalikan argumen kedua jika argumen pertama belum didefinisikan.
1617
=======
18+
=======
19+
The nullish coalescing operator is written as two question marks `??`.
20+
21+
As it treats `null` and `undefined` similarly, we'll use a special term here, in this article. We'll say that an expression is "defined" when it's neither `null` nor `undefined`.
22+
23+
The result of `a ?? b` is:
24+
- if `a` is defined, then `a`,
25+
- if `a` isn't defined, then `b`.
26+
27+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
1728
In other words, `??` returns the first argument if it's not `null/undefined`. Otherwise, the second one.
1829
>>>>>>> d6e88647b42992f204f57401160ebae92b358c0d
1930
@@ -25,22 +36,34 @@ Kita bisa menulis ulang `result = a ?? b` menggunakan operator yang sudah kita k
2536
result = (a !== null && a !== undefined) ? a : b;
2637
```
2738

39+
<<<<<<< HEAD
2840
Penggunaan umum untuk `??` adalah untuk menyediakan nilai _default_ untuk variabel yang mungkin _undefined_.
2941

3042
Sebagai contoh, kita disini menampilkan `Anonymous` jika `user` belum didefinisikan:
43+
=======
44+
Now it should be absolutely clear what `??` does. Let's see where it helps.
45+
46+
The common use case for `??` is to provide a default value for a potentially undefined variable.
47+
48+
For example, here we show `user` if defined, otherwise `Anonymous`:
49+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
3150
3251
```js run
3352
let user;
3453

35-
alert(user ?? "Anonymous"); // Anonymous
54+
alert(user ?? "Anonymous"); // Anonymous (user not defined)
3655
```
3756
57+
<<<<<<< HEAD
3858
tentu saja, jika `user` memiliki nilai apapun kecuali `null/undefined`, maka kita akan bisa melihat nilainya:
59+
=======
60+
Here's the example with `user` assigned to a name:
61+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
3962
4063
```js run
4164
let user = "John";
4265

43-
alert(user ?? "Anonymous"); // John
66+
alert(user ?? "Anonymous"); // John (user defined)
4467
```
4568
4669
<<<<<<< HEAD
@@ -49,9 +72,15 @@ Kita juga bisa menggunakan rentetan `??` untuk mendapatkan nilai yang telah dide
4972
We can also use a sequence of `??` to select the first value from a list that isn't `null/undefined`.
5073
>>>>>>> d6e88647b42992f204f57401160ebae92b358c0d
5174
75+
<<<<<<< HEAD
5276
Katakan kita memiliki sebuah data _user_ didalam sebuah variabel `firstName`, `lastName`, atau `nickName`. Semuanya mungkin saya memiliki nilai _undefined_, jika _user_ nya tidak memasukan nilainya.
5377
5478
Kita ingin menampilkan nama _user_ menggunakan salah satu dari variabel ini, atau menampilkan "Anonymous" jika semua nilainya adalah _undefined_.
79+
=======
80+
Let's say we have a user's data in variables `firstName`, `lastName` or `nickName`. All of them may be not defined, if the user decided not to enter a value.
81+
82+
We'd like to display the user name using one of these variables, or show "Anonymous" if all of them aren't defined.
83+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
5584
5685
Kita coba gunakan operator `??` untuk hal itu:
5786
@@ -83,7 +112,11 @@ alert(firstName || lastName || nickName || "Anonymous"); // Supercoder
83112
*/!*
84113
```
85114
115+
<<<<<<< HEAD
86116
Operator OR `||` sudah ada sejak awal mula dari Javascript, jadi sudah sejak lama pengembang menggunakan operator _or_ untuk kebutuhan seperti contoh diatas.
117+
=======
118+
Historically, the OR `||` operator was there first. It exists since the beginning of JavaScript, so developers were using it for such purposes for a long time.
119+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
87120
88121
<<<<<<< HEAD
89122
Disisi yang lain, operator penggabung nullish `??` baru saja ditambahkan, dan alasan penambahannya adalah karena para pengembang kurang senang dengan `||`.
@@ -113,6 +146,7 @@ alert(height || 100); // 100
113146
alert(height ?? 100); // 0
114147
```
115148
149+
<<<<<<< HEAD
116150
<<<<<<< HEAD
117151
Disini, kita memiliki _height_ nol.
118152
@@ -130,10 +164,24 @@ Jika kita asumsikan bahwa _height_ nol adalah nilai yang valid, maka nilainya ti
130164
131165
If the zero height is a valid value, that shouldn't be replaced with the default, then `??` does just the right thing.
132166
>>>>>>> d6e88647b42992f204f57401160ebae92b358c0d
167+
=======
168+
- The `height || 100` checks `height` for being a falsy value, and it's `0`, falsy indeed.
169+
- so the result of `||` is the second argument, `100`.
170+
- The `height ?? 100` checks `height` for being `null/undefined`, and it's not,
171+
- so the result is `height` "as is", that is `0`.
172+
173+
In practice, the zero height is often a valid value, that shouldn't be replaced with the default. So `??` does just the right thing.
174+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
133175
134176
## Precedence/Hak lebih tinggi
135177
178+
<<<<<<< HEAD
136179
_Precedence_ dari operator `??` agak rendah: `5` didalam [tabel MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table). Jadi `??` akan dievaluasi sebelum `=` dan `?`, tapi setelah di kebanyakan dari operasi lainnya, seperti `+`, `*`.
180+
=======
181+
The precedence of the `??` operator is about the same as `||`, just a bit lower. It equals `5` in the [MDN table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table), while `||` is `6`.
182+
183+
That means that, just like `||`, the nullish coalescing operator `??` is evaluated before `=` and `?`, but after most other operations, such as `+`, `*`.
184+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
137185
138186
Jadi jika kita ingin memilih sebuah nilai dengan `??` didalam sebuah ekspresi dengan operator lain, cobalah untuk menggunakan kurung:
139187
@@ -167,7 +215,11 @@ Kode dibawah akan menampilkan sintaks error:
167215
let x = 1 && 2 ?? 3; // Syntax error
168216
```
169217
218+
<<<<<<< HEAD
170219
Tentu saja batasan seperti itu bisa diperdebatkan, akan tetapi hal itu telah ditambahkan kedalam spesifikasi bahasanya dengan tujuan untuk menghindari kesalahan memprogram, sebagaimana orang-orang mulai berpindah dari `??` ke `||`.
220+
=======
221+
The limitation is surely debatable, it was added to the language specification with the purpose to avoid programming mistakes, when people start to switch from `||` to `??`.
222+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
171223
172224
Gunakan kurung yang jelas jika ingin menggunakannya:
173225

1-js/02-first-steps/13-while-for/article.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,11 @@ alert('Done!');
318318

319319
Kita butuh cara untuk menghentikan proses jika pengguna membatalkan input.
320320

321+
<<<<<<< HEAD
321322
`break` biasa setelah `input` hanya akan menghentikan perulangan dalam. Itu tidak cukup--label, datang untuk menyelamatkan!
323+
=======
324+
The ordinary `break` after `input` would only break the inner loop. That's not sufficient -- labels, come to the rescue!
325+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
322326
323327
Label adalah sebuah pengidentifikasi dengan sebuah titik dua sebelum perulangan:
324328
```js
@@ -363,12 +367,31 @@ Label tidak mengizinkan kita untuk lompat ke sembarang tempat dalam kode.
363367
364368
Misalnya, mustahil melakukan ini:
365369
```js
370+
<<<<<<< HEAD
366371
break label; // tidak lompak ke label di bawah
372+
=======
373+
break label; // jump to the label below (doesn't work)
374+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
367375
368376
label: for (...)
369377
```
370378
379+
<<<<<<< HEAD
371380
Sebuah panggilan untuk `break/continue` hanya mungkin dari dalam sebuah perulangan dan label harus berada diatas perintah.
381+
=======
382+
A `break` directive must be inside a code block. Technically, any labelled code block will do, e.g.:
383+
```js
384+
label: {
385+
// ...
386+
break label; // works
387+
// ...
388+
}
389+
```
390+
391+
...Although, 99.9% of the time `break` used is inside loops, as we've seen in the examples above.
392+
393+
A `continue` is only possible from inside a loop.
394+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96
372395
````
373396

374397
## Ringkasan

1-js/02-first-steps/15-function-basics/2-rewrite-function-question-or/solution.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ function checkAge(age) {
1515
}
1616
```
1717

18+
<<<<<<< HEAD
1819
Catatan bahwa tanda kurung sekitar `age > 18` tidak dibutuhkan disini. Mereka ada hanya untuk lebih enak dibaca.
20+
=======
21+
Note that the parentheses around `age > 18` are not required here. They exist for better readability.
22+
>>>>>>> 6ab384f2512902d74e4b0ff5a6be60e48ab52e96

0 commit comments

Comments
 (0)