Repository navigation
Object methods, "this" - #99
Conversation
| W wiΔkszoΕci przeglΔ darek wiadomoΕΔ o bΕΔdzie nie zawiera zbyt wielu szczegΓ³ΕΓ³w mΓ³wiΔ cych co poszΕo nie tak. | ||
|
|
||
| The error message in most browsers does not give us much of a clue about what went wrong. | ||
| **BΕΔ d wystΔ piΕ poniewaΕΌ nie ma Εrednika po`user = {...}`.** |
There was a problem hiding this comment.
missing space between "po" and "`user..."
| ``` | ||
|
|
||
| Then we can also see that such a joint expression is syntactically a call of the object `{ go: ... }` as a function with the argument `(user.go)`. And that also happens on the same line with `let user`, so the `user` object has not yet even been defined, hence the error. | ||
| Teraz widzimy, ΕΌe taka skΕadnia jest w zasadzie wywoΕaniem funkcji `{ go: ... }` z argumentem `(user.go)`. W dodatku wywoΕanie to znajduje siΔ w tej samej linijce co `let user`, wiΔc do obiekt `user` nie zostaΕ jeszcze nawet zdefiniowany, dlatego pojawia siΔ bΕΔ d. |
There was a problem hiding this comment.
The sense of the first sentence has changed a bit. It should be something like: "Teraz widzimy, ΕΌe taka skΕadnia jest w zasadzie wywoΕaniem objektu { go: ... } jako funkcji z argumentem...".
Also, please remove redunand "do" word from that part of the second sentence: "wiΔc do obiekt user nie zostaΕ jeszcze..."
| --- | ||
|
|
||
| # Syntax check | ||
| # Sprawdzian ze skΕadni |
There was a problem hiding this comment.
It should be more like: "Sprawdzenie skΕadni"
| 1. Jest to zwykΕe wywoΕanie metody obiektu. | ||
|
|
||
| 2. The same, brackets do not change the order of operations here, the dot is first anyway. | ||
| 2. Tak jak powyΕΌej. Nawiasy nie zmieniajΔ tutaj kolejnoΕci wykonywania dziaΕaΕ. Kropka ma pierwszeΕstwo. |
There was a problem hiding this comment.
Please try to avoid splitting one original sentence into some smaller ones while translating.
So please change that to: "Tak jak powyΕΌej, nawiasy nie zmieniajΔ tutaj kolejnoΕci wykonywania dziaΕaΕ, kropka i tak ma pierwszeΕstwo."
| --- | ||
|
|
||
| # Explain the value of "this" | ||
| # OkreΕl wartoΕΔ "this": |
There was a problem hiding this comment.
Please remove redunand ":" sign at the end of line.
| WartoΕΔ `this` jest tu ustalona wyΕΔ cznie dla tej funkcji. Bloki kodu i obiekty nie sΔ w tym przypadku brane pod uwagΔ. | ||
|
|
||
| So `ref: this` actually takes current `this` of the function. | ||
| Zatem `ref:this` jest rΓ³wnoznaczne z `this` funkcji. |
There was a problem hiding this comment.
Please change "ref:this" into "ref: this" just for clarity.
| --- | ||
|
|
||
| # Using "this" in object literal | ||
| # "this" w literaΕach obiektowych |
There was a problem hiding this comment.
"UΕΌywanie this w obiektach" sounds better to me.
| PoniΕΌsza funkcja `makeUser` zwraca obiekt. | ||
|
|
||
| What is the result of accessing its `ref`? Why? | ||
| Jaki bΔdzie rezultat dostΔpu do jego `ref` ? I dlaczego? |
There was a problem hiding this comment.
please remove space between ref and question mark
| CzΔsto siΔ zdarza, ΕΌe metoda obiektu do poprawnego dziaΕania potrzebuje dostΔpu do informacji zawartej w tym samym obiekcie. | ||
|
|
||
| For instance, the code inside `user.sayHi()` may need the name of the `user`. | ||
| DLa przykΕadu, kod wewnΔ trz `user.sayHi()` moΕΌe wymagaΔ imienia uΕΌytkownika `user`. |
There was a problem hiding this comment.
word "DLa" should have only first letter capital
| MoΕΌliwe jest rΓ³wnieΕΌ uzyskanie dostΔpu do obiektu bez uΕΌywania `this`, przez odwoΕanie siΔ do niego za pomocΔ zmiennej z zewnΔ trz: | ||
|
|
||
| ```js | ||
| ```js run |
|
Please make the requested changes. After it, add a comment "/done". |
|
/done |
|
Thank you π I updated the Progress Issue #1 π π π |
No description provided.