Merge pull request #2027 from lumosmind/patch-48
clarifying example code
This commit is contained in:
commit
32cf594e90
1 changed files with 3 additions and 0 deletions
|
@ -197,6 +197,9 @@ alert(admin.fullName); // John Smith (*)
|
|||
|
||||
// setter triggers!
|
||||
admin.fullName = "Alice Cooper"; // (**)
|
||||
|
||||
alert(admin.fullName); // Alice Cooper , state of admin modified
|
||||
alert(user.fullName); // John Smith , state of user protected
|
||||
```
|
||||
|
||||
Here in the line `(*)` the property `admin.fullName` has a getter in the prototype `user`, so it is called. And in the line `(**)` the property has a setter in the prototype, so it is called.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue