You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/04-object-basics/01-object/article.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,6 @@ let user = {
83
83

84
84
85
85
86
-
````smart header="Trailing comma"
87
86
The last property in the list may end with a comma:
88
87
```js
89
88
let user = {
@@ -92,7 +91,6 @@ let user = {
92
91
}
93
92
```
94
93
That is called a "trailing" or "hanging" comma. Makes it easier to add/remove/move around properties, because all lines become alike.
95
-
````
96
94
97
95
## Square brackets
98
96
@@ -226,7 +224,7 @@ That can become a source of bugs and even vulnerabilies if we intent to store ar
226
224
227
225
In that case the visitor may choose "__proto__" as the key, and the assignment logic will be ruined (as shown above).
228
226
229
-
There exist a way to make objects treat `__proto__` as a regular property, we'll cover it later, but first we need to know more about objects to understand it.
227
+
There is a way to make objects treat `__proto__` as a regular property, which we'll cover later, but first we need to know more about objects.
230
228
There's also another data structure [Map](info:map-set-weakmap-weakset), that we'll learn in the chapter <info:map-set-weakmap-weakset>, which supports arbitrary keys.
231
229
````
232
230
@@ -370,7 +368,7 @@ Also, we could use another variable name here instead of `key`. For instance, `"
370
368
371
369
### Ordered like an object
372
370
373
-
Are objects ordered? In other words, if we loop over an object, do we get all properties in the same order that they are added in it? Can we rely on it?
371
+
Are objects ordered? In other words, if we loop over an object, do we get all properties in the same order they were added? Can we rely on this?
374
372
375
373
The short answer is: "ordered in a special fashion": integer properties are sorted, others appear in creation order. The details follow.
376
374
@@ -514,7 +512,7 @@ admin.name = 'Pete'; // changed by the "admin" reference
514
512
alert(*!*user.name*/!*); //'Pete', changes are seen from the "user" reference
515
513
```
516
514
517
-
The example above demonstrates that there is only one object. Like if we had a cabinet with two keys and used one of them (`admin`) to get into it. Then, if we later use the other key (`user`) we would see changes.
515
+
The example above demonstrates that there is only one object. As if we had a cabinet with two keys and used one of them (`admin`) to get into it. Then, if we later use the other key (`user`) we would see changes.
518
516
519
517
### Comparison by reference
520
518
@@ -541,7 +539,7 @@ let b = {}; // two independent objects
541
539
alert( a == b ); // false
542
540
```
543
541
544
-
For comparisons like `obj1 > obj2` or for a comparison against a primitive `obj ==5`, objects are converted to primitives. We'll study how object conversions work very soon, but to say the truth, such comparisons are necessary very rarely and usually are a result of a coding mistake.
542
+
For comparisons like `obj1 > obj2` or for a comparison against a primitive `obj ==5`, objects are converted to primitives. We'll study how object conversions work very soon, but to tell the truth, such comparisons are necessary very rarely and usually are a result of a coding mistake.
545
543
546
544
### Const object
547
545
@@ -739,4 +737,4 @@ There are many other kinds of objects in JavaScript:
739
737
740
738
They have their special features that we'll study later. Sometimes people say something like "Array type" or "Date type", but formally they are not types of their own, but belong to a single "object" data type. And they extend it in various ways.
741
739
742
-
Objects in JavaScript are very powerful. Here we've just scratched the surface of the topic that is really huge. We'll be closely working with objects and learning more about them in further parts of the tutorial.
740
+
Objects in JavaScript are very powerful. Here we've just scratched the surface of a topic that is really huge. We'll be closely working with objects and learning more about them in further parts of the tutorial.
Copy file name to clipboardExpand all lines: 2-ui/1-document/01-browser-environment/article.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,8 +80,8 @@ Browser Object Model (BOM) are additional objects provided by the browser (host
80
80
81
81
For instance:
82
82
83
-
-[navigator](mdn:api/Window/navigator) object provides background information about the browser and the operating system. There are many properties, but the two most widely known are: `navigator.userAgent` -- about the current browser, and `navigator.platform` -- about the platform (can help to differ between Windows/Linux/Mac etc).
84
-
-[location](mdn:api/Window/location) object allows us to read the current URL and can redirect the browser to a new one.
83
+
-The [navigator](mdn:api/Window/navigator) object provides background information about the browser and the operating system. There are many properties, but the two most widely known are: `navigator.userAgent` -- about the current browser, and `navigator.platform` -- about the platform (can help to differ between Windows/Linux/Mac etc).
84
+
-The [location](mdn:api/Window/location) object allows us to read the current URL and can redirect the browser to a new one.
85
85
86
86
Here's how we can use the `location` object:
87
87
@@ -112,7 +112,7 @@ CSSOM specification
112
112
: Describes stylesheets and style rules, manipulations with them and their binding to documents, see <https://www.w3.org/TR/cssom-1/>.
113
113
114
114
HTML specification
115
-
: Describes HTML language (tags etc.) and also BOM (browser object model) -- various browser functions: `setTimeout`, `alert`, `location` and so on, see <https://html.spec.whatwg.org>. It takes DOM specification and extends it with many additional properties and methods.
115
+
: Describes the HTML language (e.g. tags) and also the BOM (browser object model) -- various browser functions: `setTimeout`, `alert`, `location` and so on, see <https://html.spec.whatwg.org>. It takes the DOM specification and extends it with many additional properties and methods.
116
116
117
117
Now we'll get down to learning DOM, because the document plays the central role in the UI.
0 commit comments