Skip to content

Commit 4e04bcb

Browse files
authored
Merge pull request #6 from javascript-tutorial/master
Update Repo
2 parents 4f6356b + 8812070 commit 4e04bcb

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

Diff for: 1-js/02-first-steps/07-operators/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Here's an extract from the [precedence table](https://developer.mozilla.org/en/J
148148
| 3 | assignment | `=` |
149149
| ... | ... | ... |
150150

151-
As we can see, the "unary plus" has a priority of `16` which is higher than the `13` of "addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
151+
As we can see, the "unary plus" has a priority of `17` which is higher than the `13` of "addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
152152
153153
## Assignment
154154

Diff for: 1-js/04-object-basics/04-object-methods/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ user.sayHi(); // Hello!
6363
```smart header="Object-oriented programming"
6464
When we write our code using objects to represent entities, that's called [object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming), in short: "OOP".
6565
66-
OOP is a big thing, an interesting science of its own. How to choose the right entities? How to organize the interaction between them? That's architecture, and there are great books on that topic, like "Design Patterns: Elements of Reusable Object-Oriented Software" by E.Gamma, R.Helm, R.Johnson, J.Vissides or "Object-Oriented Analysis and Design with Applications" by G.Booch, and more.
66+
OOP is a big thing, an interesting science of its own. How to choose the right entities? How to organize the interaction between them? That's architecture, and there are great books on that topic, like "Design Patterns: Elements of Reusable Object-Oriented Software" by E. Gamma, R. Helm, R. Johnson, J. Vissides or "Object-Oriented Analysis and Design with Applications" by G. Booch, and more.
6767
```
6868
### Method shorthand
6969

Diff for: 1-js/05-data-types/06-iterable/article.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Iterables
33

4-
*Iterable* objects is a generalization of arrays. That's a concept that allows to make any object useable in a `for..of` loop.
4+
*Iterable* objects is a generalization of arrays. That's a concept that allows us to make any object useable in a `for..of` loop.
55

66
Of course, Arrays are iterable. But there are many other built-in objects, that are iterable as well. For instance, strings are also iterable.
77

@@ -224,12 +224,12 @@ let arr = Array.from(range);
224224
alert(arr); // 1,2,3,4,5 (array toString conversion works)
225225
```
226226

227-
The full syntax for `Array.from` allows to provide an optional "mapping" function:
227+
The full syntax for `Array.from` also allows us to provide an optional "mapping" function:
228228
```js
229229
Array.from(obj[, mapFn, thisArg])
230230
```
231231

232-
The optional second argument `mapFn` can be a function that will be applied to each element before adding to the array, and `thisArg` allows to set `this` for it.
232+
The optional second argument `mapFn` can be a function that will be applied to each element before adding it to the array, and `thisArg` allows us to set `this` for it.
233233

234234
For instance:
235235

Diff for: 1-js/06-advanced-functions/03-closure/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ let arr = [f(), f(), f()];
345345

346346
A Lexical Environment object dies when it becomes unreachable (just like any other object). In other words, it exists only while there's at least one nested function referencing it.
347347

348-
In the code below, after the nested function is removed, its enclosing Lexical Environment (and hence the `value`) is cleaned from memory;
348+
In the code below, after the nested function is removed, its enclosing Lexical Environment (and hence the `value`) is cleaned from memory:
349349

350350
```js
351351
function f() {

Diff for: 1-js/06-advanced-functions/04-var/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ So in the example above, `if (false)` branch never executes, but that doesn't ma
153153

154154
**Declarations are hoisted, but assignments are not.**
155155

156-
That's better to demonstrate with an example, like this:
156+
That's best demonstrated with an example:
157157

158158
```js run
159159
function sayHi() {

Diff for: 1-js/12-generators-iterators/2-async-iterators-generators/article.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Async iterators and generators
33

4-
Asynchronous iterators allow to iterate over data that comes asynchronously, on-demand. For instance, when we download something chunk-by-chunk over a network. Asynchronous generators make it even more convenient.
4+
Asynchronous iterators allow us to iterate over data that comes asynchronously, on-demand. Like, for instance, when we download something chunk-by-chunk over a network. And asynchronous generators make it even more convenient.
55

66
Let's see a simple example first, to grasp the syntax, and then review a real-life use case.
77

@@ -52,7 +52,7 @@ If necessary, please refer to the [chapter about iterables](info:iterable) for d
5252
To make the object iterable asynchronously:
5353
1. We need to use `Symbol.asyncIterator` instead of `Symbol.iterator`.
5454
2. `next()` should return a promise.
55-
3. To iterate over such an object, we should use `for await (let item of iterable)` loop.
55+
3. To iterate over such an object, we should use a `for await (let item of iterable)` loop.
5656

5757
Let's make an iterable `range` object, like the one before, but now it will return values asynchronously, one per second:
5858

@@ -109,7 +109,7 @@ As we can see, the structure is similar to regular iterators:
109109

110110
1. To make an object asynchronously iterable, it must have a method `Symbol.asyncIterator` `(1)`.
111111
2. This method must return the object with `next()` method returning a promise `(2)`.
112-
3. The `next()` method doesn't have to be `async`, it may be a regular method returning a promise, but `async` allows to use `await`, so that's convenient. Here we just delay for a second `(3)`.
112+
3. The `next()` method doesn't have to be `async`, it may be a regular method returning a promise, but `async` allows us to use `await`, so that's convenient. Here we just delay for a second `(3)`.
113113
4. To iterate, we use `for await(let value of range)` `(4)`, namely add "await" after "for". It calls `range[Symbol.asyncIterator]()` once, and then its `next()` for values.
114114

115115
Here's a small cheatsheet:
@@ -268,7 +268,7 @@ So far we've seen simple examples, to gain basic understanding. Now let's review
268268
269269
There are many online services that deliver paginated data. For instance, when we need a list of users, a request returns a pre-defined count (e.g. 100 users) - "one page", and provides a URL to the next page.
270270
271-
This pattern is very common. It's not about users, but just about anything. For instance, GitHub allows to retrieve commits in the same, paginated fashion:
271+
This pattern is very common. It's not about users, but just about anything. For instance, GitHub allows us to retrieve commits in the same, paginated fashion:
272272
273273
- We should make a request to URL in the form `https://api.github.com/repos/<repo>/commits`.
274274
- It responds with a JSON of 30 commits, and also provides a link to the next page in the `Link` header.

0 commit comments

Comments
 (0)