Skip to content

Commit c9f8bf6

Browse files
authored
translated
1 parent 95071a1 commit c9f8bf6

File tree

1 file changed

+10
-11
lines changed
  • 1-js/04-object-basics/04-object-methods/3-why-this

1 file changed

+10
-11
lines changed
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11

2-
Here's the explanations.
2+
Oto wyjaśnienie.
33

4-
1. That's a regular object method call.
4+
1. Jest to zwykłe wywołanie metody obiektu.
55

6-
2. The same, brackets do not change the order of operations here, the dot is first anyway.
6+
2. Tak jak powyżej. Nawiasy nie zmieniają tutaj kolejności wykonywania działań. Kropka ma pierwszeństwo.
77

8-
3. Here we have a more complex call `(expression).method()`. The call works as if it were split into two lines:
8+
3. Tutaj mamy bardziej złożone wywołanie `(expression).method()`. Wywołanie działa tutaj tak jakby było rozbite na dwie linijki kodu:
99

1010
```js no-beautify
11-
f = obj.go; // calculate the expression
12-
f(); // call what we have
11+
f = obj.go; // przypisanie jako wartość zmiennej
12+
f(); // wywołanie stworzonej zmiennej
1313
```
1414

15-
Here `f()` is executed as a function, without `this`.
15+
`f()` jest tutaj wywoływane jako funkcja, bez `this`.
1616

17-
4. The similar thing as `(3)`, to the left of the dot `.` we have an expression.
17+
4. Podobna sytuacja jak w `(3)`, po lewej stronie od kropki `.` mamy wyrażenie.
1818

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.
20-
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`.
19+
Żeby wyjaśnić zachowanie `(3)` i `(4)` musimy przypomnieć sobie, że akcesory właściwości (kropki lub nawiasy kwadratowe) zwracają wartość Typu Referencji.
2220

21+
Każda inna operacja niż wywołanie metody (jak przypisanie `=` lub `||`) zmienia Typ Referencji w zwykłą wartość, która nie zawiera informacji pozwalającej ustawić wartość `this`.

0 commit comments

Comments
 (0)