Skip to content

Commit 56986ea

Browse files
authored
Merge pull request #60 from dummyeuy/master
JSON Methods, toJSON (task and solution)
2 parents 536e695 + b826555 commit 56986ea

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

1-js/05-data-types/12-json/1-serialize-object/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# Turn the object into JSON and back
5+
# Ubah objek menjadi JSON dan sebaliknya
66

7-
Turn the `user` into JSON and then read it back into another variable.
7+
Ubahlah `user` menjadi JSON dan kemudian baca kembali menjadi variabel lain.
88

99
```js
1010
let user = {

1-js/05-data-types/12-json/2-serialize-event-circular/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ alert( JSON.stringify(meetup, function replacer(key, value) {
2626
*/
2727
```
2828

29-
Here we also need to test `key==""` to exclude the first call where it is normal that `value` is `meetup`.
29+
Disini kita juga perlu untuk menguji `key==""` untuk tidak memasukkan panggilan pertama dimana properti tersebut normal ketika `value` adalah `meetup`.
3030

1-js/05-data-types/12-json/2-serialize-event-circular/task.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ importance: 5
22

33
---
44

5-
# Exclude backreferences
5+
# Tidak memasukkan referensi balik
66

7-
In simple cases of circular references, we can exclude an offending property from serialization by its name.
7+
Dalam kasus-kasus sederhana tentang referensi sirkular, kita bisa tidak memasukkan sebuah properti tertentu dari proses serialisasi berdasarkan namanya.
88

9-
But sometimes we can't just use the name, as it may be used both in circular references and normal properties. So we can check the property by its value.
9+
Namun terkadang kita tidak bisa menggunakan nama saja, sebagaimana bisa saja properti tersebut menggunakan referensi sirkular dan (berfungsi sebagai) properti normal. Jadi kita bisa memeriksa properti berdasarkan nilainya.
1010

11-
Write `replacer` function to stringify everything, but remove properties that reference `meetup`:
11+
Tulis fungsi `replacer` untuk me-*stringify* semuanya, tetapi menghilangkan propertii yang me-referensi ke `meetup`:
1212

1313
```js run
1414
let room = {
@@ -22,16 +22,16 @@ let meetup = {
2222
};
2323

2424
*!*
25-
// circular references
25+
// referensi-referensi sirkular
2626
room.occupiedBy = meetup;
2727
meetup.self = meetup;
2828
*/!*
2929

3030
alert( JSON.stringify(meetup, function replacer(key, value) {
31-
/* your code */
31+
/* kodemu */
3232
}));
3333

34-
/* result should be:
34+
/* hasil yang diharapkan yakni:
3535
{
3636
"title":"Conference",
3737
"occupiedBy":[{"name":"John"},{"name":"Alice"}],

0 commit comments

Comments
 (0)