flushing the typos buffer
This commit is contained in:
parent
e6a2f98c9d
commit
8353525053
6 changed files with 12 additions and 12 deletions
|
@ -55,7 +55,7 @@ alert(user.fullName); // John Smith
|
|||
*/!*
|
||||
```
|
||||
|
||||
From outside, an accessor property looks like a regular one. That's the idea of accessor properties. We don't call `user.fullName` as a function, we read it normally: the getter runs behind the scenes.
|
||||
From outside, an accessor property looks like a regular one. That's the idea of accessor properties. We don't **call** `user.fullName` as a function, we **read** it normally: the getter runs behind the scenes.
|
||||
|
||||
As of now, `fullName` has only a getter. If we attempt to assign `user.fullName=`, there will be an error.
|
||||
|
||||
|
@ -97,7 +97,7 @@ Sometimes it's normal that there's only a setter or only a getter. But the prope
|
|||
|
||||
## Accessor descriptors
|
||||
|
||||
Descriptors for accessor properties are different.
|
||||
Descriptors for accessor properties are different - as compared with data properties.
|
||||
|
||||
For accessor properties, there is no `value` and `writable`, but instead there are `get` and `set` functions.
|
||||
|
||||
|
@ -182,7 +182,7 @@ Technically, the external code may still access the name directly by using `user
|
|||
|
||||
## Using for compatibility
|
||||
|
||||
One of great ideas behind getters and setters -- they allow to take control over a "normal" data property and tweak it at any moment.
|
||||
One of the great ideas behind getters and setters -- they allow to take control over a "normal" data property and tweak it at any moment.
|
||||
|
||||
For instance, we started implementing user objects using data properties `name` and `age`:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue