Skip to content

Commit b83f2d7

Browse files
committed
Fix typos in 'Proxy and Reflect'
1 parent dccca58 commit b83f2d7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

1-js/99-js-misc/01-proxy/01-error-nonexisting/solution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ function wrap(target) {
1919
user = wrap(user);
2020

2121
alert(user.name); // John
22-
alert(user.age); // ReferenceError: Property doesn't exist "age"
22+
alert(user.age); // ReferenceError: Property doesn't exist: "age"
2323
```

1-js/99-js-misc/01-proxy/01-error-nonexisting/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ user = wrap(user);
2727

2828
alert(user.name); // John
2929
*!*
30-
alert(user.age); // ReferenceError: Property doesn't exist "age"
30+
alert(user.age); // ReferenceError: Property doesn't exist: "age"
3131
*/!*
3232
```

1-js/99-js-misc/01-proxy/article.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ As there are no traps, all operations on `proxy` are forwarded to `target`.
3939

4040
As we can see, without any traps, `proxy` is a transparent wrapper around `target`.
4141

42-
![](proxy.svg)
42+
![](proxy.svg)
4343

4444
`Proxy` is a special "exotic object". It doesn't have own properties. With an empty `handler` it transparently forwards operations to `target`.
4545

@@ -335,7 +335,7 @@ let user = {
335335
_password: "secret"
336336
};
337337

338-
alert(user._password); // secret
338+
alert(user._password); // secret
339339
```
340340

341341
Let's use proxies to prevent any access to properties starting with `_`.
@@ -376,7 +376,7 @@ user = new Proxy(user, {
376376
},
377377
*!*
378378
deleteProperty(target, prop) { // to intercept property deletion
379-
*/!*
379+
*/!*
380380
if (prop.startsWith('_')) {
381381
throw new Error("Access denied");
382382
} else {
@@ -437,7 +437,7 @@ user = {
437437
```
438438

439439

440-
A call to `user.checkPassword()` call gets proxied `user` as `this` (the object before dot becomes `this`), so when it tries to access `this._password`, the `get` trap activates (it triggers on any property read) and throws an error.
440+
A call to `user.checkPassword()` gets proxied `user` as `this` (the object before dot becomes `this`), so when it tries to access `this._password`, the `get` trap activates (it triggers on any property read) and throws an error.
441441

442442
So we bind the context of object methods to the original object, `target`, in the line `(*)`. Then their future calls will use `target` as `this`, without any traps.
443443

0 commit comments

Comments
 (0)