Skip to content

Commit 2df5dbe

Browse files
committed
� Conflicts: � 1-js/02-first-steps/02-structure/article.md � 1-js/02-first-steps/07-operators/article.md
2 parents c309aa0 + 405150f commit 2df5dbe

11 files changed

Lines changed: 26 additions & 24 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,11 @@ As for now, it's important to know that such behavior of `__proto__` can become
301301

302302
The problem is that a visitor may choose `__proto__` as the key, and the assignment logic will be ruined (as shown above).
303303

304-
Later we'll see workarounds for the problem:
305-
1. We'll see how to make an objects treat `__proto__` as a regular property in the chapter [](info:prototype-methods).
306-
2. There's also study another data structure [Map](info:map-set) in the chapter <info:map-set>, which supports arbitrary keys.
304+
There are two workarounds for the problem:
305+
1. Modify the object's behavior to treat `__proto__` as a regular property. We'll learn how to do it in the chapter [](info:prototype-methods).
306+
2. Using [Map](info:map-set) data structure which supports arbitrary keys. We'll learn it in the chapter <info:map-set>.
307307

308-
## Property existance test, "in" operator
308+
## Property existence test, "in" operator
309309

310310
A notable objects feature is that it's possible to access any property. There will be no error if the property doesn't exist! Accessing a non-existing property just returns `undefined`. It provides a very common way to test whether the property exists -- to get it and compare vs undefined:
311311

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

Lines changed: 1 addition & 1 deletion
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

1-js/05-data-types/04-array/10-maximal-subarray/task.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ The task is: find the contiguous subarray of `arr` with the maximal sum of items
1010

1111
Write the function `getMaxSubSum(arr)` that will return that sum.
1212

13-
For instance:
13+
For instance:
1414

1515
```js
16-
getMaxSubSum([-1, *!*2, 3*/!*, -9]) = 5 (the sum of highlighted items)
17-
getMaxSubSum([*!*2, -1, 2, 3*/!*, -9]) = 6
18-
getMaxSubSum([-1, 2, 3, -9, *!*11*/!*]) = 11
19-
getMaxSubSum([-2, -1, *!*1, 2*/!*]) = 3
20-
getMaxSubSum([*!*100*/!*, -9, 2, -3, 5]) = 100
21-
getMaxSubSum([*!*1, 2, 3*/!*]) = 6 (take all)
16+
getMaxSubSum([-1, *!*2, 3*/!*, -9]) == 5 (the sum of highlighted items)
17+
getMaxSubSum([*!*2, -1, 2, 3*/!*, -9]) == 6
18+
getMaxSubSum([-1, 2, 3, -9, *!*11*/!*]) == 11
19+
getMaxSubSum([-2, -1, *!*1, 2*/!*]) == 3
20+
getMaxSubSum([*!*100*/!*, -9, 2, -3, 5]) == 100
21+
getMaxSubSum([*!*1, 2, 3*/!*]) == 6 (take all)
2222
```
2323

2424
If all items are negative, it means that we take none (the subarray is empty), so the sum is zero:

1-js/05-data-types/05-array-methods/12-reduce-object/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let users = [
2020
let usersById = groupById(users);
2121

2222
/*
23-
// after the call we have:
23+
// after the call we should have:
2424
2525
usersById = {
2626
john: {id: 'john', name: "John Smith", age: 20}

1-js/06-advanced-functions/01-recursion/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ let company = {
302302
salary: 1000
303303
}, {
304304
name: 'Alice',
305-
salary: 600
305+
salary: 1600
306306
}],
307307
308308
development: {
@@ -350,7 +350,7 @@ The algorithm is probably even easier to read from the code:
350350
351351
```js run
352352
let company = { // the same object, compressed for brevity
353-
sales: [{name: 'John', salary: 1000}, {name: 'Alice', salary: 600 }],
353+
sales: [{name: 'John', salary: 1000}, {name: 'Alice', salary: 1600 }],
354354
development: {
355355
sites: [{name: 'Peter', salary: 2000}, {name: 'Alex', salary: 1800 }],
356356
internals: [{name: 'Jack', salary: 1300}]
@@ -372,7 +372,7 @@ function sumSalaries(department) {
372372
}
373373
*/!*
374374
375-
alert(sumSalaries(company)); // 6700
375+
alert(sumSalaries(company)); // 7700
376376
```
377377
378378
The code is short and easy to understand (hopefully?). That's the power of recursion. It also works for any level of subdepartment nesting.

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

Lines changed: 1 addition & 1 deletion
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() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ So in the example above, `if (false)` branch never executes, but that doesn't ma
138138

139139
**Declarations are hoisted, but assignments are not.**
140140

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

143143
```js run
144144
function sayHi() {

1-js/11-async/06-promisify/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function promisify(f) {
5151
return new Promise((resolve, reject) => {
5252
function callback(err, result) { // our custom callback for f
5353
if (err) {
54-
return reject(err);
54+
reject(err);
5555
} else {
5656
resolve(result);
5757
}
@@ -82,7 +82,7 @@ function promisify(f, manyArgs = false) {
8282
return new Promise((resolve, reject) => {
8383
function *!*callback(err, ...results*/!*) { // our custom callback for f
8484
if (err) {
85-
return reject(err);
85+
reject(err);
8686
} else {
8787
// resolve with all callback results if manyArgs is specified
8888
*!*resolve(manyArgs ? results : results[0]);*/!*

1-js/99-js-misc/01-proxy/article.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ A `Proxy` object wraps another object and intercepts operations, like reading/wr
44

55
Proxies are used in many libraries and some browser frameworks. We'll see many practical applications in this article.
66

7+
## Proxy
8+
79
The syntax:
810

911
```js

5-network/01-fetch/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Fetch
33

4-
JavaScript can send network requests to the server and load new information whenever is needed.
4+
JavaScript can send network requests to the server and load new information whenever it's needed.
55

66
For example, we can use a network request to:
77

@@ -66,7 +66,7 @@ if (response.ok) { // if HTTP-status is 200-299
6666
- **`response.formData()`** -- return the response as `FormData` object (explained in the [next chapter](info:formdata)),
6767
- **`response.blob()`** -- return the response as [Blob](info:blob) (binary data with type),
6868
- **`response.arrayBuffer()`** -- return the response as [ArrayBuffer](info:arraybuffer-binary-arrays) (low-level representaion of binary data),
69-
- additionally, `response.body` is a [ReadableStream](https://streams.spec.whatwg.org/#rs-class) object, it allows to read the body chunk-by-chunk, we'll see an example later.
69+
- additionally, `response.body` is a [ReadableStream](https://streams.spec.whatwg.org/#rs-class) object, it allows you to read the body chunk-by-chunk, we'll see an example later.
7070

7171
For instance, let's get a JSON-object with latest commits from GitHub:
7272

@@ -230,7 +230,7 @@ But, as we're going to send JSON, we use `headers` option to send `application/j
230230

231231
We can also submit binary data with `fetch` using `Blob` or `BufferSource` objects.
232232

233-
In this example, there's a `<canvas>` where we can draw by moving a mouse over it. A click on the "submit" button sends the image to server:
233+
In this example, there's a `<canvas>` where we can draw by moving a mouse over it. A click on the "submit" button sends the image to the server:
234234

235235
```html run autorun height="90"
236236
<body style="margin:0">

0 commit comments

Comments
 (0)