Skip to content

Commit abb3639

Browse files
authored
Merge pull request #42 from lanasta/master
Translations for js/data-types/map-set
2 parents 025cc58 + 902796a commit abb3639

File tree

6 files changed

+142
-144
lines changed

6 files changed

+142
-144
lines changed

1-js/05-data-types/07-map-set/01-array-unique-map/task.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ importance: 5
44

55
# Filter unique array members
66

7-
Let `arr` be an array.
7+
Anggaplah `arr` sebagai sebuah array.
88

9-
Create a function `unique(arr)` that should return an array with unique items of `arr`.
9+
Ciptakanlah fungsi `unique(arr)` yang harus mengembalikan array yang berisi nilai-nilai unik dari `arr`.
1010

11-
For instance:
11+
Sebagai contoh:
1212

1313
```js
1414
function unique(arr) {
@@ -22,6 +22,6 @@ let values = ["Hare", "Krishna", "Hare", "Krishna",
2222
alert( unique(values) ); // Hare, Krishna, :-O
2323
```
2424

25-
P.S. Here strings are used, but can be values of any type.
25+
P.S. Disini string dipakai sebagai contoh, tetapi nilai dengan tipe apa saja bisa dipakai.
2626

27-
P.P.S. Use `Set` to store unique values.
27+
P.P.S. Pakailah `Set` untuk menyimpan nilai-nilai yang unik.

1-js/05-data-types/07-map-set/02-filter-anagrams/solution.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
To find all anagrams, let's split every word to letters and sort them. When letter-sorted, all anagrams are same.
1+
Untuk menemukan semua anagram, mari kita pecahkan setiap kata menjadi huruf-huruf dan urutkanlah. Ketika huruf-huruf terurut, semua anagram adalah sama.
22

3-
For instance:
3+
Sebagai contoh:
44

55
```
66
nap, pan -> anp
@@ -9,7 +9,7 @@ cheaters, hectares, teachers -> aceehrst
99
...
1010
```
1111

12-
We'll use the letter-sorted variants as map keys to store only one value per each key:
12+
Kita akan menggunakan varian yang diurutkan berdasarkan huruf sebagai kunci map untuk menyimpan hanya satu nilai untuk setiap kunci:
1313

1414
```js run
1515
function aclean(arr) {
@@ -31,9 +31,9 @@ let arr = ["nap", "teachers", "cheaters", "PAN", "ear", "era", "hectares"];
3131
alert( aclean(arr) );
3232
```
3333

34-
Letter-sorting is done by the chain of calls in the line `(*)`.
34+
Penyortiran huruf dilakukan oleh deretan panggilan di baris `(*)`.
3535

36-
For convenience let's split it into multiple lines:
36+
Untuk kenyamanan marilah kita pecahkan menjadi beberapa baris:
3737

3838
```js
3939
let sorted = arr[i] // PAN
@@ -43,21 +43,21 @@ let sorted = arr[i] // PAN
4343
.join(''); // anp
4444
```
4545

46-
Two different words `'PAN'` and `'nap'` receive the same letter-sorted form `'anp'`.
46+
Dua kata berbeda `'PAN'` dan`' nap'` mendapatkan form urutan huruf yang sama `'anp'`.
4747

48-
The next line put the word into the map:
48+
Baris berikutnya menempatkan kata tersebut ke dalam map:
4949

5050
```js
5151
map.set(sorted, word);
5252
```
5353

54-
If we ever meet a word the same letter-sorted form again, then it would overwrite the previous value with the same key in the map. So we'll always have at maximum one word per letter-form.
54+
Jika kita pernah bertemu kata dengan urutan huruf yang sama lagi, maka kata itu akan menggantikan nilai sebelumnya dengan kunci yang sama di dalam map. Maka dari itu kita akan selalu mempunyai maksimum satu kata untuk setiap form huruf.
5555

56-
At the end `Array.from(map.values())` takes an iterable over map values (we don't need keys in the result) and returns an array of them.
56+
Akhirnya `Array.from(map.values())` mengambil iterable atas nilai-nilai map (kita tidak memperlukan kunci-kunci dalam hasilnya) dan mengembalikan array dengan isi tersebut.
5757

58-
Here we could also use a plain object instead of the `Map`, because keys are strings.
58+
Disini kita juga bisa menggunakan objek biasa daripada `Map`, karena kunci adalah string.
5959

60-
That's how the solution can look:
60+
Solusinya bisa terlihat seperti ini:
6161

6262
```js run demo
6363
function aclean(arr) {
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
importance: 4
1+
nilai penting: 4
22

33
---
44

5-
# Filter anagrams
5+
# Filter anagram
66

7-
[Anagrams](https://en.wikipedia.org/wiki/Anagram) are words that have the same number of same letters, but in different order.
7+
[Anagram](https://en.wikipedia.org/wiki/Anagram) adalah kata-kata yang mempunyai jumlah huruf-huruf yang sama, tetapi dengan susunan yang berbeda.
88

9-
For instance:
9+
Sebagai contoh:
1010

1111
```
1212
nap - pan
1313
ear - are - era
1414
cheaters - hectares - teachers
1515
```
1616

17-
Write a function `aclean(arr)` that returns an array cleaned from anagrams.
17+
Ciptakanlah fungsi `aclean(arr)` yang mengembalikan array yang bersih dari anagram.
1818

19-
For instance:
19+
Sebagai contoh:
2020

2121
```js
2222
let arr = ["nap", "teachers", "cheaters", "PAN", "ear", "era", "hectares"];
2323

2424
alert( aclean(arr) ); // "nap,teachers,ear" or "PAN,cheaters,era"
2525
```
2626

27-
From every anagram group should remain only one word, no matter which one.
28-
27+
Dari setiap grup anagram hanya harus tersisa satu kata, boleh yang mana saja.

1-js/05-data-types/07-map-set/03-iterable-keys/solution.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

2-
That's because `map.keys()` returns an iterable, but not an array.
3-
4-
We can convert it into an array using `Array.from`:
2+
Itu karena `map.keys()` mengembalikan iterable, tetapi bukan sebuah array.
53

4+
Kita bisa mengubahnya ke sebuah array menggunakan `Array.from`:
65

76
```js run
87
let map = new Map();

1-js/05-data-types/07-map-set/03-iterable-keys/task.md

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

33
---
44

5-
# Iterable keys
5+
# Kunci-kunci iterable
66

7-
We'd like to get an array of `map.keys()` in a variable and then do apply array-specific methods to it, e.g. `.push`.
7+
Kami ingin mendapatkan array daripada `map.keys()` dalam satu variabel lalu mengaplikasikan metode yang array spesifik kepadanya, contoh `.push`.
88

9-
But that doesn't work:
9+
Tapi itu tidak berhasil:
1010

1111
```js run
1212
let map = new Map();
@@ -21,4 +21,4 @@ keys.push("more");
2121
*/!*
2222
```
2323

24-
Why? How can we fix the code to make `keys.push` work?
24+
Mengapa? Bagaimana kita bisa membenarkan kode ini untuk membuat `keys.push` berhasil?

0 commit comments

Comments
 (0)