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/01-getting-started/1-intro/article.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ The engine applies optimizations at each step of the process. It even watches th
45
45
46
46
Modern JavaScript is a "safe" programming language. It does not provide low-level access to memory or CPU, because it was initially created for browsers which do not require it.
47
47
48
-
Javascript's capabilities greatly depend on the environment it's running in. For instance, [Node.JS](https://wikipedia.org/wiki/Node.js) supports functions that allow JavaScript to read/write arbitrary files, perform network requests, etc.
48
+
JavaScript's capabilities greatly depend on the environment it's running in. For instance, [Node.JS](https://wikipedia.org/wiki/Node.js) supports functions that allow JavaScript to read/write arbitrary files, perform network requests, etc.
49
49
50
50
In-browser JavaScript can do everything related to webpage manipulation, interaction with the user, and the webserver.
51
51
@@ -88,7 +88,7 @@ There are at least *three* great things about JavaScript:
88
88
+ Simple things are done simply.
89
89
+ Support by all major browsers and enabled by default.
90
90
```
91
-
Javascript is the only browser technology that combines these three things.
91
+
JavaScript is the only browser technology that combines these three things.
92
92
93
93
That's what makes JavaScript unique. That's why it's the most widespread tool for creating browser interfaces.
Copy file name to clipboardExpand all lines: 1-js/06-advanced-functions/03-closure/article.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,7 +221,7 @@ function sayHiBye(firstName, lastName) {
221
221
}
222
222
```
223
223
224
-
Here the *nested* function `getFullName()` is made for convenience. It can access the outer variables and so can return the full name. Nested functions are quite common in Javascript.
224
+
Here the *nested* function `getFullName()` is made for convenience. It can access the outer variables and so can return the full name. Nested functions are quite common in JavaScript.
225
225
226
226
What's much more interesting, a nested function can be returned: either as a property of a new object (if the outer function creates an object with methods) or as a result by itself. It can then be used somewhere else. No matter where, it still has access to the same outer variables.
227
227
@@ -473,7 +473,7 @@ The code outside of the block (or inside another script) doesn't see variables i
473
473
474
474
### IIFE
475
475
476
-
In the past, there were no block-level lexical environment in Javascript.
476
+
In the past, there were no block-level lexical environment in JavaScript.
477
477
478
478
So programmers had to invent something. And what they did is called "immediately-invoked function expressions" (abbreviated as IIFE).
Copy file name to clipboardExpand all lines: 1-js/06-advanced-functions/05-global-object/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ No, it's not, because it may lead to naming conflicts: the same variable name ca
79
79
80
80
As of now, the multi-purpose `window` is considered a design mistake in the language.
81
81
82
-
Luckily, there's a "road out of hell", called "Javascript modules".
82
+
Luckily, there's a "road out of hell", called "JavaScript modules".
83
83
84
84
If we set `type="module"` attribute on a `<script>` tag, then such script is considered a separate "module" with its own top-level scope (lexical environment), not interfering with `window`.
Copy file name to clipboardExpand all lines: 1-js/08-prototypes/04-prototype-methods/article.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
4
4
In the first chapter of this section, we mentioned that there are modern methods to setup a prototype.
5
5
6
-
The `__proto__` is considered outdated and somewhat deprecated (in browser-only part of the Javascript standard).
6
+
The `__proto__` is considered outdated and somewhat deprecated (in browser-only part of the JavaScript standard).
7
7
8
8
The modern methods are:
9
9
@@ -81,7 +81,7 @@ Why was `__proto__` replaced by the functions? That's an interesting question, r
81
81
```warn header="Don't reset `[[Prototype]]` unless the speed doesn't matter"
82
82
Technically, we can get/set `[[Prototype]]` at any time. But usually we only set it once at the object creation time, and then do not modify: `rabbit` inherits from `animal`, and that is not going to change.
83
83
84
-
And JavaScript engines are highly optimized to that. Changing a prototype "on-the-fly" with `Object.setPrototypeOf` or `obj.__proto__=` is a very slow operation, it breaks internal optimizations for object property access operations. So evade it unless you know what you're doing, or Javascript speed totally doesn't matter for you.
84
+
And JavaScript engines are highly optimized to that. Changing a prototype "on-the-fly" with `Object.setPrototypeOf` or `obj.__proto__=` is a very slow operation, it breaks internal optimizations for object property access operations. So evade it unless you know what you're doing, or JavaScript speed totally doesn't matter for you.
Copy file name to clipboardExpand all lines: 1-js/09-classes/04-private-protected-properties-methods/article.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,9 +55,9 @@ In JavaScript, there are three types of properties and members:
55
55
56
56
In many other languages there also exist "protected" fields: accessible only from inside the class and those extending it. They are also useful for the internal interface. They are in a sense more widespread than private ones, because we usually want inheriting classes to gain access to properly do the extension.
57
57
58
-
Protected fields are not implemented in Javascript on the language level, but in practice they are very convenient, so they are emulated.
58
+
Protected fields are not implemented in JavaScript on the language level, but in practice they are very convenient, so they are emulated.
59
59
60
-
In the next step we'll make a coffee machine in Javascript with all these types of properties. A coffee machine has a lot of details, we won't model them to stay simple (though we could).
60
+
In the next step we'll make a coffee machine in JavaScript with all these types of properties. A coffee machine has a lot of details, we won't model them to stay simple (though we could).
61
61
62
62
## Protecting "waterAmount"
63
63
@@ -186,7 +186,7 @@ So protected fields are naturally inheritable. Unlike private ones that we'll se
186
186
187
187
[recent browser=none]
188
188
189
-
There's a finished Javascript proposal, almost in the standard, that provides language-level support for private properties and methods.
189
+
There's a finished JavaScript proposal, almost in the standard, that provides language-level support for private properties and methods.
190
190
191
191
Privates should start with `#`. They are only accessible from inside the class.
192
192
@@ -325,6 +325,6 @@ Hiding complexity
325
325
To hide internal interface we use either protected or public properties:
326
326
327
327
- Protected fields start with `_`. That's a well-known convention, not enforced at the language level. Programmers should only access a field starting with `_` from its class and classes inheriting from it.
328
-
- Private fields start with `#`. Javascript makes sure we only can access those from inside the class.
328
+
- Private fields start with `#`. JavaScript makes sure we only can access those from inside the class.
329
329
330
330
Right now, private fields are not well-supported among browsers, but can be polyfilled.
Copy file name to clipboardExpand all lines: 1-js/11-async/07-microtask-queue/article.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ As said in the [specification](https://tc39.github.io/ecma262/#sec-jobs-and-job-
30
30
- The queue is first-in-first-out: tasks enqueued first are run first.
31
31
- Execution of a task is initiated only when nothing else is running.
32
32
33
-
Or, to say that simply, when a promise is ready, its `.then/catch/finally` handlers are put into the queue. They are not executed yet. Javascript engine takes a task from the queue and executes it, when it becomes free from the current code.
33
+
Or, to say that simply, when a promise is ready, its `.then/catch/finally` handlers are put into the queue. They are not executed yet. JavaScript engine takes a task from the queue and executes it, when it becomes free from the current code.
34
34
35
35
That's why "code finished" in the example above shows first.
36
36
@@ -54,7 +54,7 @@ Now the order is as intended.
54
54
55
55
## Event loop
56
56
57
-
In-browser Javascript, as well as Node.js, is based on an *event loop*.
57
+
In-browser JavaScript, as well as Node.js, is based on an *event loop*.
58
58
59
59
"Event loop" is a process when the engine sleeps and waits for events, then reacts on those and sleeps again.
Copy file name to clipboardExpand all lines: 1-js/11-async/08-async-await/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ async function f() {
12
12
}
13
13
```
14
14
15
-
The word "async" before a function means one simple thing: a function always returns a promise. Even If a function actually returns a non-promise value, prepending the function definition with the "async" keyword directs Javascript to automatically wrap that value in a resolved promise.
15
+
The word "async" before a function means one simple thing: a function always returns a promise. Even If a function actually returns a non-promise value, prepending the function definition with the "async" keyword directs JavaScript to automatically wrap that value in a resolved promise.
16
16
17
17
For instance, the code above returns a resolved promise with the result of `1`, let's test it:
Copy file name to clipboardExpand all lines: 1-js/12-generators-iterators/1-generators/01-pseudo-random-generator/task.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ There are many areas where we need random data.
5
5
6
6
One of them is testing. We may need random data: text, numbers etc, to test things out well.
7
7
8
-
In Javascript, we could use `Math.random()`. But if something goes wrong, we'd like to be able to repeat the test, using exactly the same data.
8
+
In JavaScript, we could use `Math.random()`. But if something goes wrong, we'd like to be able to repeat the test, using exactly the same data.
9
9
10
10
For that, so called "seeded pseudo-random generators" are used. They take a "seed", the first value, and then generate next ones using a formula. So that the same seed yields the same sequence, and hence the whole flow is easily reproducible. We only need to remember the seed to repeat it.
Copy file name to clipboardExpand all lines: 1-js/12-generators-iterators/1-generators/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -462,7 +462,7 @@ If we don't catch the error there, then, as usual, it falls through to the outer
462
462
- Inside generators (only) there exists a `yield` operator.
463
463
- The outer code and the generator may exchange results via `next/yield` calls.
464
464
465
-
In modern Javascript, generators are rarely used. But sometimes they come in handy, because the ability of a function to exchange data with the calling code during the execution is quite unique.
465
+
In modern JavaScript, generators are rarely used. But sometimes they come in handy, because the ability of a function to exchange data with the calling code during the execution is quite unique.
466
466
467
467
Also, in the next chapter we'll learn async generators, which are used to read streams of asynchronously generated data in `for` loop.
0 commit comments