Skip to content

Commit 85be7a5

Browse files
authored
Merge pull request #2 from iliakan/master
Repo Update 4-Aug, 2018
2 parents 8c714da + 62226ef commit 85be7a5

File tree

27 files changed

+38
-38
lines changed

27 files changed

+38
-38
lines changed

Diff for: 1-js/02-first-steps/01-hello-world/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The `<script>` tag has a few attributes that are rarely used nowadays, but we ca
4747

4848
The `type` attribute: <code>&lt;script <u>type</u>=...&gt;</code>
4949

50-
: The old standard HTML4 required a script to have a type. Usually it was `type="text/javascript"`. The modern HTML standard assumes this `type` by default. No attribute is required.
50+
: The old standard HTML4 required a script to have a type. Usually it was `type="text/javascript"`. It's not required any more. Also, the modern standard totally changed the meaning of this attribute. Now it can be used for Javascript modules. But that's an advanced topic, but we'll talk about modules later in another part of the tutorial.
5151

5252
The `language` attribute: <code>&lt;script <u>language</u>=...&gt;</code>
5353
: This attribute was meant to show the language of the script. As of now, this attribute makes no sense, the language is JavaScript by default. No need to use it.

Diff for: 1-js/02-first-steps/04-variables/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ const myBirthday = '18.04.1982';
247247
myBirthday = '01.01.2001'; // error, can't reassign the constant!
248248
```
249249
250-
When a programmer is sure that the variable should never change, he can use `const` to guarantee it, and also to clearly show that fact to everyone.
250+
When a programmer is sure that the variable should never change, they can use `const` to guarantee it, and also to clearly show that fact to everyone.
251251
252252
253253
### Uppercase constants

Diff for: 1-js/02-first-steps/12-while-for/6-repeat-until-correct/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 5
44

55
# Repeat until the input is correct
66

7-
Write a loop which prompts for a number greater than `100`. If the visitor enters another number -- ask him to input again.
7+
Write a loop which prompts for a number greater than `100`. If the visitor enters another number -- ask them to input again.
88

99
The loop must ask for a number until either the visitor enters a number greater than `100` or cancels the input/enters an empty line.
1010

Diff for: 1-js/02-first-steps/16-javascript-specials/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ More in: <info:variables> and <info:types>.
103103
We're using a browser as a working environment, so basic UI functions will be:
104104

105105
[`prompt(question[, default])`](mdn:api/Window/prompt)
106-
: Ask a `question`, and return either what the visitor entered or `null` if he pressed "cancel".
106+
: Ask a `question`, and return either what the visitor entered or `null` if they pressed "cancel".
107107

108108
[`confirm(question)`](mdn:api/Window/confirm)
109109
: Ask a `question` and suggest to choose between Ok and Cancel. The choice is returned as `true/false`.
110110

111111
[`alert(message)`](mdn:api/Window/alert)
112112
: Output a `message`.
113113

114-
All these functions are *modal*, they pause the code execution and prevent the visitor from interacting with the page until he answers.
114+
All these functions are *modal*, they pause the code execution and prevent the visitor from interacting with the page until they answer.
115115

116116
For instance:
117117

Diff for: 1-js/03-code-quality/04-ninja-code/article.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ i = i ? i < 0 ? Math.max(0, len + i) : i : 0;
3434

3535
Cool, right? If you write like that, the developer who comes across this line and tries to understand what is the value of `i` is going to have a merry time. Then come to you, seeking for an answer.
3636

37-
Tell him that shorter is always better. Initiate him into the paths of ninja.
37+
Tell them that shorter is always better. Initiate them into the paths of ninja.
3838

3939
## One-letter variables
4040

@@ -45,11 +45,11 @@ completed.
4545

4646
Another way to code faster is to use single-letter variable names everywhere. Like `a`, `b` or `c`.
4747

48-
A short variable disappears in the code like a real ninja in the forest. No one will be able to find it using "search" of the editor. And even if someone does, he won't be able to "decipher" what the name `a` or `b` means.
48+
A short variable disappears in the code like a real ninja in the forest. No one will be able to find it using "search" of the editor. And even if someone does, they won't be able to "decipher" what the name `a` or `b` means.
4949

5050
...But there's an exception. A real ninja will never use `i` as the counter in a `"for"` loop. Anywhere, but not here. Look around, there are many more exotic letters. For instance, `x` or `y`.
5151

52-
An exotic variable as a loop counter is especially cool if the loop body takes 1-2 pages (make it longer if you can). Then if someone looks deep inside the loop, he won't be able to quickly figure out that the variable named `x` is the loop counter.
52+
An exotic variable as a loop counter is especially cool if the loop body takes 1-2 pages (make it longer if you can). Then if someone looks deep inside the loop, they won't be able to quickly figure out that the variable named `x` is the loop counter.
5353

5454
## Use abbreviations
5555

@@ -153,7 +153,7 @@ function ninjaFunction(elem) {
153153
}
154154
```
155155

156-
A fellow programmer who wants to work with `elem` in the second half of the function will be surprised... Only during the debugging, after examining the code he will find out that he's working with a clone!
156+
A fellow programmer who wants to work with `elem` in the second half of the function will be surprised... Only during the debugging, after examining the code they will find out that he's working with a clone!
157157

158158
Deadly effective even against an experienced ninja. Seen in code regularly.
159159

@@ -204,7 +204,7 @@ There are functions that look like they don't change anything. Like `isReady()`,
204204

205205
**A really beautiful trick is to add a "useful" action to them, besides the main task.**
206206

207-
The expression of dazed surprise on the face of your colleague when he sees a function named `is..`, `check..` or `find...` changing something -- will definitely broaden your boundaries of reason.
207+
The expression of dazed surprise on the face of your colleague when they see a function named `is..`, `check..` or `find...` changing something -- will definitely broaden your boundaries of reason.
208208

209209
**Another way to surprise is to return a non-standard result.**
210210

@@ -228,7 +228,7 @@ Additional actions should not be obvious from the function name. A true ninja co
228228

229229
**Joining several actions into one protects your code from reuse.**
230230

231-
Imagine, another developer wants only to check the email, and not output any message. Your function `validateEmail(email)` that does both will not suit him. So he won't break your meditation by asking anything about it.
231+
Imagine, another developer wants only to check the email, and not output any message. Your function `validateEmail(email)` that does both will not suit them. So they won't break your meditation by asking anything about it.
232232

233233
## Summary
234234

Diff for: 1-js/03-code-quality/06-polyfills/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Here Babel comes to the rescue.
1919

2020
Actually, there are two parts in Babel:
2121

22-
1. First, the transpiler program, which rewrites the code. The developer runs it on his own computer. It rewrites the code into the older standard. And then the code is delivered to the website for users. Modern project build system like [webpack](http://webpack.github.io/) or [brunch](http://brunch.io/) provide means to run transpiler automatically on every code change, so that doesn't involve any time loss from our side.
22+
1. First, the transpiler program, which rewrites the code. The developer runs it on their own computer. It rewrites the code into the older standard. And then the code is delivered to the website for users. Modern project build system like [webpack](http://webpack.github.io/) or [brunch](http://brunch.io/) provide means to run transpiler automatically on every code change, so that doesn't involve any time loss from our side.
2323

2424
2. Second, the polyfill.
2525

Diff for: 1-js/05-data-types/02-number/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Strange! What is it then if not `0.3`?
201201
alert( 0.1 + 0.2 ); // 0.30000000000000004
202202
```
203203

204-
Ouch! There are more consequences than an incorrect comparison here. Imagine you're making an e-shopping site and the visitor puts `$0.10` and `$0.20` goods into his chart. The order total will be `$0.30000000000000004`. That would surprise anyone.
204+
Ouch! There are more consequences than an incorrect comparison here. Imagine you're making an e-shopping site and the visitor puts `$0.10` and `$0.20` goods into their chart. The order total will be `$0.30000000000000004`. That would surprise anyone.
205205

206206
But why does this happen?
207207

Diff for: 1-js/05-data-types/03-string/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ Let's recap these methods to avoid any confusion:
451451
```smart header="Which one to choose?"
452452
All of them can do the job. Formally, `substr` has a minor drawback: it is described not in the core JavaScript specification, but in Annex B, which covers browser-only features that exist mainly for historical reasons. So, non-browser environments may fail to support it. But in practice it works everywhere.
453453
454-
The author finds himself using `slice` almost all the time.
454+
The author finds themself using `slice` almost all the time.
455455
```
456456

457457
## Comparing strings

Diff for: 1-js/05-data-types/04-array/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ It's rarely used, because square brackets `[]` are shorter. Also there's a trick
369369

370370
If `new Array` is called with a single argument which is a number, then it creates an array *without items, but with the given length*.
371371

372-
Let's see how one can shoot himself in the foot:
372+
Let's see how one can shoot themself in the foot:
373373

374374
```js run
375375
let arr = new Array(2); // will it create an array of [2] ?

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ For instance:
4747
```js run
4848
let john = { name: "John" };
4949

50-
// for every user, let's store his visits count
50+
// for every user, let's store their visits count
5151
let visitsCountMap = new Map();
5252

5353
// john is the key for the map
@@ -332,7 +332,7 @@ That's useful for situations when we have a main storage for the objects somewhe
332332
333333
Let's look at an example.
334334
335-
For instance, we have code that keeps a visit count for each user. The information is stored in a map: a user is the key and the visit count is the value. When a user leaves, we don't want to store his visit count anymore.
335+
For instance, we have code that keeps a visit count for each user. The information is stored in a map: a user is the key and the visit count is the value. When a user leaves, we don't want to store their visit count anymore.
336336
337337
One way would be to keep track of leaving users and clean up the storage manually:
338338

Diff for: 1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ So we'll assign `throttle(update, 100)` as the function to run on each mouse mov
2222

2323
Visually, it will look like this:
2424

25-
1. For the first mouse movement the decorated variant passes the call to `update`. That's important, the user sees our reaction to his move immediately.
25+
1. For the first mouse movement the decorated variant passes the call to `update`. That's important, the user sees our reaction to their move immediately.
2626
2. Then as the mouse moves on, until `100ms` nothing happens. The decorated variant ignores calls.
2727
3. At the end of `100ms` -- one more `update` happens with the last coordinates.
2828
4. Then, finally, the mouse stops somewhere. The decorated variant waits until `100ms` expire and then runs `update` runs with last coordinates. So, perhaps the most important, the final mouse coordinates are processed.

Diff for: 1-js/07-object-oriented-programming/01-property-descriptors/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ user.name = "Pete"; // Error: Cannot assign to read only property 'name'...
118118
*/!*
119119
```
120120

121-
Now no one can change the name of our user, unless he applies his own `defineProperty` to override ours.
121+
Now no one can change the name of our user, unless they apply their own `defineProperty` to override ours.
122122

123123
Here's the same operation, but for the case when a property doesn't exist:
124124

Diff for: 1-js/07-object-oriented-programming/03-prototype-inheritance/4-hamster-proto/solution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ alert( lazy.stomach ); // <nothing>
4444

4545
Now all works fine, because `this.stomach=` does not perform a lookup of `stomach`. The value is written directly into `this` object.
4646

47-
Also we can totally evade the problem by making sure that each hamster has his own stomach:
47+
Also we can totally evade the problem by making sure that each hamster has their own stomach:
4848

4949
```js run
5050
let hamster = {

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ You can find more detailed information about JSON in the <info:json> chapter.
194194

195195
Should we be satisfied with that? Of course, not!
196196

197-
This way, if something's wrong with the data, the visitor will never know that (unless he opens developer console). And people really don't like when something "just dies" without any error message.
197+
This way, if something's wrong with the data, the visitor will never know that (unless they open the developer console). And people really don't like when something "just dies" without any error message.
198198

199199
Let's use `try..catch` to handle the error:
200200
@@ -575,7 +575,7 @@ The information from this section is not a part of the core JavaScript.
575575
576576
Let's imagine we've got a fatal error outside of `try..catch`, and the script died. Like a programming error or something else terrible.
577577
578-
Is there a way to react on such occurrences? We may want to log the error, show something to the user (normally he doesn't see error messages) etc.
578+
Is there a way to react on such occurrences? We may want to log the error, show something to the user (normally they don't see error messages) etc.
579579
580580
There is none in the specification, but environments usually provide it, because it's really useful. For instance, Node.JS has [process.on('uncaughtException')](https://nodejs.org/api/process.html#process_event_uncaughtexception) for that. And in the browser we can assign a function to special [window.onerror](mdn:api/GlobalEventHandlers/onerror) property. It will run in case of an uncaught error.
581581

Diff for: 2-ui/2-events/04-default-browser-action/2-catch-link-navigation/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 5
44

55
# Catch links in the element
66

7-
Make all links inside the element with `id="contents"` ask the user if he really wants to leave. And if he doesn't then don't follow.
7+
Make all links inside the element with `id="contents"` ask the user if they really want to leave. And if they don't then don't follow.
88

99
Like this:
1010

Diff for: 2-ui/3-event-details/1-mouse-events-basics/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Now if you double-click on "Unselectable", it doesn't get selected. Seems to wor
175175

176176
...But there is a potential problem! The text became truly unselectable. Even if a user starts the selection from "Before" and ends with "After", the selection skips "Unselectable" part. Do we really want to make our text unselectable?
177177

178-
Most of time, we don't. A user may have valid reasons to select the text, for copying or other needs. That may be inconvenient if we don't allow him to do it. So this solution is not that good.
178+
Most of time, we don't. A user may have valid reasons to select the text, for copying or other needs. That may be inconvenient if we don't allow them to do it. So this solution is not that good.
179179

180180
What we want is to prevent the selection on double-click, that's it.
181181

Diff for: 2-ui/3-event-details/10-onload-ondomcontentloaded/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Each event may be useful:
1010

1111
- `DOMContentLoaded` event -- DOM is ready, so the handler can lookup DOM nodes, initialize the interface.
1212
- `load` event -- additional resources are loaded, we can get image sizes (if not specified in HTML/CSS) etc.
13-
- `beforeunload/unload` event -- the user is leaving: we can check if the user saved the changes and ask him whether he really wants to leave.
13+
- `beforeunload/unload` event -- the user is leaving: we can check if the user saved the changes and ask them whether they really want to leave.
1414

1515
Let's explore the details of these events.
1616

Diff for: 2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/2-hoverintent/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ importance: 5
66

77
Write a function that shows a tooltip over an element only if the visitor moves the mouse *over it*, but not *through it*.
88

9-
In other words, if the visitor moves the mouse on the element and stopped -- show the tooltip. And if he just moved the mouse through fast, then no need, who wants extra blinking?
9+
In other words, if the visitor moves the mouse on the element and stopped -- show the tooltip. And if they just moved the mouse through fast, then no need, who wants extra blinking?
1010

1111
Technically, we can measure the mouse speed over the element, and if it's slow then we assume that it comes "over the element" and show the tooltip, if it's fast -- then we ignore it.
1212

Diff for: 2-ui/3-event-details/5-keyboard-events/2-check-sync-keydown/solution.view/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// JavaScript does not get the "keyup" event
2424
// and pressed set will keep assuming that the key is pressed
2525
// so, to evade "sticky" keys, we reset the status
26-
// if the user wants to run the hotkey again - let him press all keys again
26+
// if the user wants to run the hotkey again - let them press all keys again
2727
pressed.clear();
2828

2929
func();

Diff for: 2-ui/3-event-details/8-onscroll/3-load-visible-img/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 4
44

55
# Load visible images
66

7-
Let's say we have a slow-speed client and want to save his mobile traffic.
7+
Let's say we have a slow-speed client and want to save their mobile traffic.
88

99
For that purpose we decide not to show images immediately, but rather replace them with placeholders, like this:
1010

Diff for: 2-ui/4-forms-controls/4-forms-submit/1-modal-dialog/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ importance: 5
66

77
Create a function `showPrompt(html, callback)` that shows a form with the message `html`, an input field and buttons `OK/CANCEL`.
88

9-
- A user should type something into a text field and press `key:Enter` or the OK button, then `callback(value)` is called with the value he entered.
9+
- A user should type something into a text field and press `key:Enter` or the OK button, then `callback(value)` is called with the value they entered.
1010
- Otherwise if the user presses `key:Esc` or CANCEL, then `callback(null)` is called.
1111

1212
In both cases that ends the input process and removes the form.

Diff for: 4-frames-and-windows/01-popup-windows/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Still, there are some things that can be done.
176176
For instance:
177177

178178
- When we open a popup, it's might be a good idea to run a `newWindow.focus()` on it. Just in case, for some OS/browser combinations it ensures that the user is in the new window now.
179-
- If we want to track when a visitor actually uses our web-app, we can track `window.onfocus/onblur`. That allows us to suspend/resume in-page activities, animations etc. But please note that the `blur` event means that the visitor switched out from the window, but he still may observe it. The window is in the background, but still may be visible.
179+
- If we want to track when a visitor actually uses our web-app, we can track `window.onfocus/onblur`. That allows us to suspend/resume in-page activities, animations etc. But please note that the `blur` event means that the visitor switched out from the window, but they still may observe it. The window is in the background, but still may be visible.
180180

181181
## Summary
182182

0 commit comments

Comments
 (0)