Skip to content

Commit a758eff

Browse files
authored
Merge branch 'master' into sync-a0bfa924
2 parents 703a292 + a7f3481 commit a758eff

File tree

31 files changed

+730
-738
lines changed

31 files changed

+730
-738
lines changed

1-js/02-first-steps/03-strict-mode/article.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ Jika tidak, cara paling terpercaya ialah memastikan `use strict` adalah menginpu
7373

7474
## Selalu "use strict"
7575

76-
Kita belum mengcover perbedaan antara mode strict dan mode "default".
76+
Kita belum mengcover perbedaan antara mode ketat dan mode "default".
7777

78-
Di bab berikutnya, seiring kira mempelajari fitur bahasa, kita akan mencatat perbedaan antara mode strict dan default. Untungnya, itu tidak banyak dan membuat hidup kita lebih baik.
78+
Di bab berikutnya, seiring kira mempelajari fitur bahasa, kita akan mencatat perbedaan antara mode ketat dan default. Untungnya, itu tidak banyak dan membuat hidup kita lebih baik.
7979

8080
Untuk sekarang, cukup tahu sampai di sini secara umum:
8181

8282
1. Directive `"use strict"` mengganti engine ke mode "modern", changing the behavior of some built-in features. We'll see the details later in the tutorial.
83-
2. Mode strict aktif dengan menaruh `"use strict"` paling atas dari script atau function. Beberapa fitur bahasa, seperti "classe" dan "module", mengaktifkan mode strict secara otomatis.
84-
3. Mode strict didukung semua peramban modern.
85-
4. Kami sarankan selalu mulai script dengan `"use strict"`. Semua contoh di tutorial ini mengasumsikan mode strict kecuali (sangat jarang) dispesifikasi kebalikannya.
83+
2. Mode ketat aktif dengan menaruh `"use strict"` paling atas dari script atau function. Beberapa fitur bahasa, seperti "classe" dan "module", mengaktifkan mode ketat secara otomatis.
84+
3. Mode ketat didukung semua peramban modern.
85+
4. Kami sarankan selalu mulai script dengan `"use strict"`. Semua contoh di tutorial ini mengasumsikan mode ketat kecuali (sangat jarang) dispesifikasi kebalikannya.

1-js/02-first-steps/04-variables/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ num = 5; // variabel "num" dibuat jika ia tak ada
222222
alert(num); // 5
223223
```
224224

225-
Ini kebiasaan buruk dan akan mengakibatkan galat dalam mode strict:
225+
Ini kebiasaan buruk dan akan mengakibatkan galat dalam mode ketat:
226226

227227
```js
228228
"use strict";

1-js/02-first-steps/10-ifelse/5-rewrite-if-question/task.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ Nilai penting: 5
44

55
# Tulis ulang 'if' menggunakan '?'
66

7-
<<<<<<< HEAD
8-
Tulis ulang `if` menggunakan operator ternary` '?' `:
9-
=======
10-
Rewrite this `if` using the conditional operator `'?'`:
11-
>>>>>>> 8c30654f694fe8682f5631809980be931ee4ed72
7+
Tulis ulang `if` menggunakan operator kondisional `'?'`:
128

139
```js
1410
let result;

1-js/02-first-steps/10-ifelse/article.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ Untuk melakukan itu, kita dapat menggunakan pernyataan `if` dan operator kondi
66

77
## Pernyataan "if"
88

9-
<<<<<<< HEAD
10-
Pernyataan `if` mengevaluasi suatu kondisi, dan jika hasil kondisi itu benar (`true`),maka pernyataan tersebut akan mengeksekusi kode di dalam blok `if` tersebut.
11-
=======
12-
The `if(...)` statement evaluates a condition in parentheses and, if the result is `true`, executes a block of code.
13-
>>>>>>> 8c30654f694fe8682f5631809980be931ee4ed72
9+
Pernyataan `if` mengevaluasi suatu kondisi dan, jika hasil kondisi itu `true`, maka blok kode di dalam `if` akan diexekusi.
1410

1511
Sebagai contoh:
1612

1-js/02-first-steps/13-switch/1-rewrite-switch-if-else/solution.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
To precisely match the functionality of `switch`, the `if` must use a strict comparison `'==='`.
1+
Supaya fungsionalitas `switch` persis sama, `if` harus memakai pembandingan ketat `'==='`.
22

3-
For given strings though, a simple `'=='` works too.
3+
Tapi untuk string yang diberikan, `'=='` sederhana cukup bekerja juga.
44

55
```js no-beautify
66
if(browser == 'Edge') {
@@ -15,6 +15,6 @@ if(browser == 'Edge') {
1515
}
1616
```
1717

18-
Please note: the construct `browser == 'Chrome' || browser == 'Firefox' …` is split into multiple lines for better readability.
18+
Tolong ingat: konstruksi `browser == 'Chrome' || browser == 'Firefox' …` dipecah menjadi beberapa baris untuk kemudahan keterbacaan.
1919

20-
But the `switch` construct is still cleaner and more descriptive.
20+
Tapi konstruksi `switch` masih lebih bersih dan lebih deskriptif.

1-js/02-first-steps/13-switch/1-rewrite-switch-if-else/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
importance: 5
1+
nilai penting: 5
22

33
---
44

5-
# Rewrite the "switch" into an "if"
5+
# Tulis kembali "switch" menjadi "if"
66

7-
Write the code using `if..else` which would correspond to the following `switch`:
7+
Tulis kode menggunakan `if..else` yang akan berkorespon dengan `switch` berikut:
88

99
```js
1010
switch (browser) {

1-js/02-first-steps/13-switch/2-rewrite-if-switch/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The first two checks turn into two `case`. The third check is split into two cases:
1+
Dua cek pertama berubah ke `case`. Cek ketiga dipecah menjadi dua case:
22

33
```js run
44
let a = +prompt('a?', '');
@@ -21,6 +21,6 @@ switch (a) {
2121
}
2222
```
2323

24-
Please note: the `break` at the bottom is not required. But we put it to make the code future-proof.
24+
Tolong ingat: `break` di paling bawah tidak wajib. Tapi kita taruh itu supaya kodenya future-proof.
2525

26-
In the future, there is a chance that we'd want to add one more `case`, for example `case 4`. And if we forget to add a break before it, at the end of `case 3`, there will be an error. So that's a kind of self-insurance.
26+
Di masa depan, ada kans bahwa kita ingin menambah `case` lebih, misalnya `case 4`. Dan jika kita lupa menambah break sebelum itu, di akhir `case 3`, akan ada error. Jadi itu lebih ke semacam asuransi diri.

1-js/02-first-steps/13-switch/2-rewrite-if-switch/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
importance: 4
1+
nilai penting: 4
22

33
---
44

5-
# Rewrite "if" into "switch"
5+
# Tulis kembali "if" ke dalam "switch"
66

7-
Rewrite the code below using a single `switch` statement:
7+
Tulis ulang kode berikut menggunakan pernyataan `switch` tunggal:
88

99
```js run
1010
let a = +prompt('a?', '');

1-js/02-first-steps/13-switch/article.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# The "switch" statement
1+
# Pernyataan "switch"
22

3-
A `switch` statement can replace multiple `if` checks.
3+
Pernyataan `switch` bisa mengganti pengecekan ganda `if`.
44

5-
It gives a more descriptive way to compare a value with multiple variants.
5+
Ia memberi cara lebih deskriptif untuk membandingkan nilai dengan varian ganda.
66

7-
## The syntax
7+
## Syntax
88

9-
The `switch` has one or more `case` blocks and an optional default.
9+
`switch` punya satu atau lebih blok `case` dan satu default opsional.
1010

11-
It looks like this:
11+
Rupanya seperti ini:
1212

1313
```js no-beautify
1414
switch(x) {
@@ -26,13 +26,13 @@ switch(x) {
2626
}
2727
```
2828

29-
- The value of `x` is checked for a strict equality to the value from the first `case` (that is, `value1`) then to the second (`value2`) and so on.
30-
- If the equality is found, `switch` starts to execute the code starting from the corresponding `case`, until the nearest `break` (or until the end of `switch`).
31-
- If no case is matched then the `default` code is executed (if it exists).
29+
- Nilai `x` dicek ekaulitasnya secara ketat dengan nilaid dari `case` pertama (yaitu, `value1`) lalu ke kedua (`value2`) dan seterusnya.
30+
- Jika ekualitas ditemukan, `switch` mulai mengexekusi kode mulai dari `case` yang berkorespondensi, hingga `break` terdekat (atau hingga akhir `switch`).
31+
- Jika tak ada case yang cocok maka kode `default` diexekusi (jika ada).
3232

33-
## An example
33+
## Contoh
3434

35-
An example of `switch` (the executed code is highlighted):
35+
Contoh `switch` (kode yang diexekusi dihighlight):
3636

3737
```js run
3838
let a = 2 + 2;
@@ -54,13 +54,13 @@ switch (a) {
5454
}
5555
```
5656

57-
Here the `switch` starts to compare `a` from the first `case` variant that is `3`. The match fails.
57+
Di sini `switch` mulai membandingkan `a` dari varian `case` pertama yang bernilai `3`. Kecocokan gagal.
5858

59-
Then `4`. That's a match, so the execution starts from `case 4` until the nearest `break`.
59+
Lalu `4`. Ada kecocokan, jadi exekusi mulai dari `case 4` hingga `break` terdekat.
6060

61-
**If there is no `break` then the execution continues with the next `case` without any checks.**
61+
**Jika tak ada `break` maka exekusi lanjut dengan `case` berikutnya tanpa pengecekan.**
6262

63-
An example without `break`:
63+
Contoh tanpa `break`:
6464

6565
```js run
6666
let a = 2 + 2;
@@ -79,18 +79,18 @@ switch (a) {
7979
}
8080
```
8181

82-
In the example above we'll see sequential execution of three `alert`s:
82+
Di contoh di atas kita akan lihat exekusi sekuensial dari tiga `alert`:
8383

8484
```js
8585
alert( 'Exactly!' );
8686
alert( 'Too big' );
8787
alert( "I don't know such values" );
8888
```
8989

90-
````smart header="Any expression can be a `switch/case` argument"
91-
Both `switch` and `case` allow arbitrary expressions.
90+
````smart header="Expresi apapun bisa berupa argumen `switch/case`"
91+
Baik `switch` maupun `case` membolehkan sembarang expresi.
9292

93-
For example:
93+
Misalnya:
9494

9595
```js run
9696
let a = "1";
@@ -107,14 +107,14 @@ switch (+a) {
107107
alert("this doesn't run");
108108
}
109109
```
110-
Here `+a` gives `1`, that's compared with `b + 1` in `case`, and the corresponding code is executed.
110+
Di sini `+a` memberikan `1`, yang dibandingkan dengan `b + 1` ndalam `case`, and the corresponding code is executed.
111111
````
112112
113-
## Grouping of "case"
113+
## Pengelompokan "case"
114114
115-
Several variants of `case` which share the same code can be grouped.
115+
Beberapa varian `case` yang berbagi kode yang sama bisa dikelompokkan.
116116
117-
For example, if we want the same code to run for `case 3` and `case 5`:
117+
Misalnya, jika kita ingin kode yang sama berjalan untuk `case 3` dan `case 5`:
118118
119119
```js run no-beautify
120120
let a = 2 + 2;
@@ -137,15 +137,15 @@ switch (a) {
137137
}
138138
```
139139
140-
Now both `3` and `5` show the same message.
140+
Sekarang baik `3` maupun `5` menampilkan pesan yang sama.
141141
142-
The ability to "group" cases is a side-effect of how `switch/case` works without `break`. Here the execution of `case 3` starts from the line `(*)` and goes through `case 5`, because there's no `break`.
142+
Kemampuan "mengelompokkan" case adalah efek samping dari bagaimana `switch/case` bekerja tanpa `break`. Di sini exekusi dari `case 3` mulai dari baris `(*)` dan tembus ke `case 5`, karena tidak ada `break`.
143143
144-
## Type matters
144+
## Tipe berpengaruh
145145
146-
Let's emphasize that the equality check is always strict. The values must be of the same type to match.
146+
Mari kita tekankan bahwa pengecekan ekualitas selalu ketat. Nilainya harus bertipe sama supaya cocok.
147147
148-
For example, let's consider the code:
148+
Misalnya, mari kita pertimbangkan kode ini:
149149
150150
```js run
151151
let arg = prompt("Enter a value?");
@@ -167,6 +167,6 @@ switch (arg) {
167167
}
168168
```
169169
170-
1. For `0`, `1`, the first `alert` runs.
171-
2. For `2` the second `alert` runs.
172-
3. But for `3`, the result of the `prompt` is a string `"3"`, which is not strictly equal `===` to the number `3`. So we've got a dead code in `case 3`! The `default` variant will execute.
170+
1. Untuk `0`, `1`, `alert` pertama berjalan.
171+
2. Untuk `2` `alert` kedua berjalan.
172+
3. Tapi untuk `3`, hasil dari `prompt` ialah string `"3"`, yang berbeda secara ketat `===` dengan angka `3`. Jadi kita punya kode mati di `case 3`! Varian `default` akan diexekusi.

1-js/02-first-steps/14-function-basics/1-if-else-required/task.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Kepentingan: 4
1+
nilai penting: 4
2+
23
---
34

45
# Apakah "else" dibutuhkan ?

0 commit comments

Comments
 (0)