Merge pull request #2214 from leviding/patch-29
FIX: delete extra space
This commit is contained in:
commit
3897d24e7e
2 changed files with 3 additions and 3 deletions
|
@ -5,7 +5,7 @@ The global object provides variables and functions that are available anywhere.
|
||||||
|
|
||||||
In a browser it is named `window`, for Node.js it is `global`, for other environments it may have another name.
|
In a browser it is named `window`, for Node.js it is `global`, for other environments it may have another name.
|
||||||
|
|
||||||
Recently, `globalThis` was added to the language, as a standardized name for a global object, that should be supported across all environments. It's supported in all major browsers.
|
Recently, `globalThis` was added to the language, as a standardized name for a global object, that should be supported across all environments. It's supported in all major browsers.
|
||||||
|
|
||||||
We'll use `window` here, assuming that our environment is a browser. If your script may run in other environments, it's better to use `globalThis` instead.
|
We'll use `window` here, assuming that our environment is a browser. If your script may run in other environments, it's better to use `globalThis` instead.
|
||||||
|
|
||||||
|
|
|
@ -198,8 +198,8 @@ alert(admin.fullName); // John Smith (*)
|
||||||
// setter triggers!
|
// setter triggers!
|
||||||
admin.fullName = "Alice Cooper"; // (**)
|
admin.fullName = "Alice Cooper"; // (**)
|
||||||
|
|
||||||
alert(admin.fullName); // Alice Cooper , state of admin modified
|
alert(admin.fullName); // Alice Cooper, state of admin modified
|
||||||
alert(user.fullName); // John Smith , state of user protected
|
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.
|
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