Skip to content

Commit 7fa3497

Browse files
authored
Update solution.md
1 parent 8f86da2 commit 7fa3497

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

  • 1-js/99-js-misc/04-reference-type/3-why-this
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11

2-
با توجه به موارد زیر.
2+
Here's the explanations.
33

4-
1. متدی که داخل یک آبجکت معمولی بوده, اجرا شده.
4+
1. That's a regular object method call.
55

6-
2. به همین ترتیب, پرانتز در اینجا اولیت را عوض نمیکند و مهم نقطه `.` است.
6+
2. The same, parentheses do not change the order of operations here, the dot is first anyway.
77

8-
3. ما نمونه پیچیده تری نسبت به `()(expression)`. در زیر داریم که به دو خط کد تقسیم شده است:
8+
3. Here we have a more complex call `(expression)()`. The call works as if it were split into two lines:
99

1010
```js no-beautify
11-
f = obj.go; // محاسبه عبارت
12-
f(); // اجرای تابع
11+
f = obj.go; // calculate the expression
12+
f(); // call what we have
1313
```
1414

15-
اینجا `()f` به عنوان یک تابع, بدون `this` اجرا میشود.
15+
Here `f()` is executed as a function, without `this`.
1616

17-
4. در موارد مشابه `(3)`, در سمت چپ پرانتز عبارت داریم.
17+
4. The similar thing as `(3)`, to the left of the parentheses `()` we have an expression.
1818

19-
برای اینکه اتفاقاتی که در مورد `(3)` و `(4)` رج میدهد را بدانیم, باید به خاطر داشته باشیم که دسترسی به مقدار ویژگی ها (چه با نقطه یا چه با استفاده از براکت) یک مقداری از Reference Type را برمیگرداند.
19+
To explain the behavior of `(3)` and `(4)` we need to recall that property accessors (dot or square brackets) return a value of the Reference Type.
2020

21-
هر عملیاتی که برروی آن غیر از توابع (مثل عملگر تخصیص `=` یا `||`) اعمال میشود, از آن یک مقدار معمولی میسازد, که اطلاعاتی برای تنظیم مقدار `this` ندارد.
21+
Any operation on it except a method call (like assignment `=` or `||`) turns it into an ordinary value, which does not carry the information allowing to set `this`.

0 commit comments

Comments
 (0)