Skip to content

Commit ffcfda0

Browse files
committed
2 parents ae57b66 + 62a0bb5 commit ffcfda0

File tree

18 files changed

+45
-44
lines changed

18 files changed

+45
-44
lines changed

1-js/02-first-steps/10-ifelse/4-check-login/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ if (userName == 'Admin') {
99

1010
if (pass == 'TheMaster') {
1111
alert( 'Welcome!' );
12-
} else if (pass == null) {
12+
} else if (pass == '' || pass == null) {
1313
alert( 'Canceled.' );
1414
} else {
1515
alert( 'Wrong password' );
1616
}
1717

18-
} else if (userName == null) {
18+
} else if (userName == '' || userName == null) {
1919
alert( 'Canceled' );
2020
} else {
2121
alert( "I don't know you" );

1-js/02-first-steps/10-ifelse/4-check-login/task.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ The schema:
2020

2121
Please use nested `if` blocks. Mind the overall readability of the code.
2222

23+
Hint: passing an empty input to a prompt returns an empty string `''`. Pressing `key:ESC` during a prompt returns `null`.
24+
2325
[demo]

1-js/02-first-steps/10-ifelse/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ The same logic using `if..else`:
188188
```js
189189
if (age < 3) {
190190
message = 'Hi, baby!';
191-
} else if (a < 18) {
191+
} else if (age < 18) {
192192
message = 'Hello!';
193193
} else if (age < 100) {
194194
message = 'Greetings!';

1-js/04-object-basics/01-object/article.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ let user = {
8383
![](object-user-props.png)
8484

8585

86-
````smart header="Trailing comma"
8786
The last property in the list may end with a comma:
8887
```js
8988
let user = {
@@ -92,7 +91,6 @@ let user = {
9291
}
9392
```
9493
That is called a "trailing" or "hanging" comma. Makes it easier to add/remove/move around properties, because all lines become alike.
95-
````
9694

9795
## Square brackets
9896

@@ -226,7 +224,7 @@ That can become a source of bugs and even vulnerabilies if we intent to store ar
226224
227225
In that case the visitor may choose "__proto__" as the key, and the assignment logic will be ruined (as shown above).
228226
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.
230228
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.
231229
````
232230

@@ -370,7 +368,7 @@ Also, we could use another variable name here instead of `key`. For instance, `"
370368
371369
### Ordered like an object
372370
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?
374372
375373
The short answer is: "ordered in a special fashion": integer properties are sorted, others appear in creation order. The details follow.
376374
@@ -514,7 +512,7 @@ admin.name = 'Pete'; // changed by the "admin" reference
514512
alert(*!*user.name*/!*); // 'Pete', changes are seen from the "user" reference
515513
```
516514
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.
518516
519517
### Comparison by reference
520518
@@ -541,7 +539,7 @@ let b = {}; // two independent objects
541539
alert( a == b ); // false
542540
```
543541
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.
545543
546544
### Const object
547545
@@ -739,4 +737,4 @@ There are many other kinds of objects in JavaScript:
739737
740738
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.
741739
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.

1-js/05-data-types/07-map-set-weakmap-weakset/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ let recipeMap = new Map([
138138
139139
// iterate over keys (vegetables)
140140
for (let vegetable of recipeMap.keys()) {
141-
alert(vegetable); // cucumber, tomateos, onion
141+
alert(vegetable); // cucumber, tomatoes, onion
142142
}
143143
144144
// iterate over values (amounts)

1-js/06-advanced-functions/11-currying-partials/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ user.sayNow = partial(user.say, new Date().getHours() + ':' + new Date().getMinu
9595

9696
user.sayNow("Hello");
9797
// Something like:
98-
// [10:00] Hello, John!
98+
// [10:00] John: Hello!
9999
```
100100

101101
The result of `partial(func[, arg1, arg2...])` call is a wrapper `(*)` that calls `func` with:

1-js/07-object-oriented-programming/02-property-accessors/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Object.defineProperty(user, 'fullName', {
128128

129129
alert(user.fullName); // John Smith
130130

131-
for(let key in user) alert(key);
131+
for(let key in user) alert(key); // name, surname
132132
```
133133

134134
Please note once again that a property can be either an accessor or a data property, not both.

1-js/08-error-handling/1-try-catch/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ try {
295295
296296
As we can see, that's a `SyntaxError`.
297297
298-
And in our case, the absense of `name` could be treated as a syntax error also, assuming that users must have a `name`.
298+
And in our case, the absence of `name` could be treated as a syntax error also, assuming that users must have a `name`.
299299
300300
So let's throw it:
301301

2-ui/1-document/01-browser-environment/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ Browser Object Model (BOM) are additional objects provided by the browser (host
8080

8181
For instance:
8282

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.
8585

8686
Here's how we can use the `location` object:
8787

@@ -112,7 +112,7 @@ CSSOM specification
112112
: Describes stylesheets and style rules, manipulations with them and their binding to documents, see <https://www.w3.org/TR/cssom-1/>.
113113

114114
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.
116116

117117
Now we'll get down to learning DOM, because the document plays the central role in the UI.
118118

2-ui/1-document/05-basic-dom-node-properties/2-lastchild-nodetype-inline/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 5
44

55
# What's in the nodeType?
66

7-
What the script shows?
7+
What does the script show?
88

99
```html
1010
<html>

0 commit comments

Comments
 (0)