Skip to content
4 changes: 2 additions & 2 deletions 1-js/05-data-types/12-json/1-serialize-object/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 5

---

# Turn the object into JSON and back
# شیء را به جی‌سان تبدیل کنید و برعکس

Turn the `user` into JSON and then read it back into another variable.
شیء `user` را به جی‌سان تبدیل کنید و سپس آن را در متغیر دیگری بخوانید.

```js
let user = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ alert( JSON.stringify(meetup, function replacer(key, value) {
*/
```

Here we also need to test `key==""` to exclude the first call where it is normal that `value` is `meetup`.
همچنین اینجا ما نیاز داریم که `key==""` را بررسی کنیم تا اولین فراخوانی که طبیعتا `value` برابر با `meetup` است را حذف کنیم.

12 changes: 6 additions & 6 deletions 1-js/05-data-types/12-json/2-serialize-event-circular/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ importance: 5

---

# Exclude backreferences
# مرجع‌های بازگشتی را حذف کنید

In simple cases of circular references, we can exclude an offending property from serialization by its name.
در موارد ساده‌ای از مرجع‌های دایره‌ای، ما می‌توانیم یک ویژگی متخلف را توسط اسم آن از سریالی کردن منع کنیم.

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.
اما گاهی اوقات به دلیل اینکه ممکن است هم در مرجع‌های دایره‌ای و هم در ویژگی‌های عادی استفاده شده باشد، نمی‌توانیم از اسم آن استفاده کنیم. پس می‌توانیم ویژگی را با استفاده از مقدار آن بررسی کنیم.

Write `replacer` function to stringify everything, but remove properties that reference `meetup`:
تابع `replacer` بنویسید که هر چیزی را به رشته تبدیل کند اما ویژگی‌هایی که به `meetup` رجوع می‌کنند را حذف کند:

```js run
let room = {
Expand All @@ -28,10 +28,10 @@ meetup.self = meetup;
*/!*

alert( JSON.stringify(meetup, function replacer(key, value) {
/* your code */
/* کد شما */
}));

/* result should be:
/* :نتیجه باید اینگونه باشد
{
"title":"Conference",
"occupiedBy":[{"name":"John"},{"name":"Alice"}],
Expand Down
Loading