Skip to content

Commit a574f79

Browse files
committed
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-58f6599d
2 parents b650bae + 58f6599 commit a574f79

File tree

17 files changed

+296
-211
lines changed

17 files changed

+296
-211
lines changed

1-js/02-first-steps/05-types/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ We'll cover strings more thoroughly in the chapter <info:string>.
127127
```smart header="There is no *character* type."
128128
In some languages, there is a special "character" type for a single character. For example, in the C language and in Java it is called "char".
129129
130-
In JavaScript, there is no such type. There's only one type: `string`. A string may consist of only one character or many of them.
130+
In JavaScript, there is no such type. There's only one type: `string`. A string may consist of zero characters (be empty), one character or many of them.
131131
```
132132

133133
## Boolean (logical type)

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

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

33

4-
```quote author="Confucius"
4+
```quote author="Confucius (Analects)"
55
Learning without thought is labor lost; thought without learning is perilous.
66
```
77

@@ -104,8 +104,8 @@ A quick read of such code becomes impossible. And when there's a typo... Ummm...
104104

105105
## Smart synonyms
106106

107-
```quote author="Confucius"
108-
The hardest thing of all is to find a black cat in a dark room, especially if there is no cat.
107+
```quote author="Laozi (Tao Te Ching)"
108+
The Tao that can be told is not the eternal Tao. The name that can be named is not the eternal name.
109109
```
110110

111111
Using *similar* names for *same* things makes life more interesting and shows your creativity to the public.

1-js/04-object-basics/07-optional-chaining/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ If there's no variable `user` at all, then `user?.anything` triggers an error:
8080
// ReferenceError: user is not defined
8181
user?.address;
8282
```
83-
There must be `let/const/var user`. The optional chaining works only for declared variables.
83+
There must be `let/const/var user`. The optional chaining works only for declared variables.
8484
````
8585

8686
## Short-circuiting

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ An array is a special kind of object. The square brackets used to access a prope
193193

194194
They extend objects providing special methods to work with ordered collections of data and also the `length` property. But at the core it's still an object.
195195

196-
Remember, there are only eight basic data types in JavaScript (see the [Data types](https://javascript.info/types) chapter for more info). Array is an object and thus behaves like an object.
196+
Remember, there are only eight basic data types in JavaScript (see the [Data types](info:types) chapter for more info). Array is an object and thus behaves like an object.
197197

198198
For instance, it is copied by reference:
199199

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ alert( str.slice(1, 3) ); // garbage (two pieces from different surrogate pairs)
293293
Objects that can be used in `for..of` are called *iterable*.
294294

295295
- Technically, iterables must implement the method named `Symbol.iterator`.
296-
- The result of `obj[Symbol.iterator]` is called an *iterator*. It handles the further iteration process.
296+
- The result of `obj[Symbol.iterator]()` is called an *iterator*. It handles the further iteration process.
297297
- An iterator must have the method named `next()` that returns an object `{done: Boolean, value: any}`, here `done:true` denotes the end of the iteration process, otherwise the `value` is the next value.
298298
- The `Symbol.iterator` method is called automatically by `for..of`, but we also can do it directly.
299299
- Built-in iterables like strings or arrays, also implement `Symbol.iterator`.
@@ -304,4 +304,4 @@ Objects that have indexed properties and `length` are called *array-like*. Such
304304

305305
If we look inside the specification -- we'll see that most built-in methods assume that they work with iterables or array-likes instead of "real" arrays, because that's more abstract.
306306

307-
`Array.from(obj[, mapFn, thisArg])` makes a real `Array` of an iterable or array-like `obj`, and we can then use array methods on it. The optional arguments `mapFn` and `thisArg` allow us to apply a function to each item.
307+
`Array.from(obj[, mapFn, thisArg])` makes a real `Array` from an iterable or array-like `obj`, and we can then use array methods on it. The optional arguments `mapFn` and `thisArg` allow us to apply a function to each item.

1-js/06-advanced-functions/09-call-apply-decorators/03-debounce/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Then if the wrapped function is called at 0ms, 200ms and 500ms, and then there a
1616

1717
...And it will get the arguments of the very last call, other calls are ignored.
1818

19-
Here's the code for it (uses the debounce decorator from the [Lodash library](https://lodash.com/docs/4.17.15#debounce):
19+
Here's the code for it (uses the debounce decorator from the [Lodash library](https://lodash.com/docs/4.17.15#debounce)):
2020

2121
```js
2222
let f = _.debounce(alert, 1000);

1-js/08-prototypes/03-native-prototypes/article.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ We can check it like this:
3333
let obj = {};
3434

3535
alert(obj.__proto__ === Object.prototype); // true
36-
// obj.toString === obj.__proto__.toString == Object.prototype.toString
36+
37+
alert(obj.toString === obj.__proto__.toString); //true
38+
alert(obj.toString === Object.prototype.toString); //true
3739
```
3840

3941
Please note that there is no more `[[Prototype]]` in the chain above `Object.prototype`:

1-js/09-classes/02-class-inheritance/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ Why is there the difference?
364364

365365
Well, the reason is in the field initialization order. The class field is initialized:
366366
- Before constructor for the base class (that doesn't extend anything),
367-
- Imediately after `super()` for the derived class.
367+
- Immediately after `super()` for the derived class.
368368

369369
In our case, `Rabbit` is the derived class. There's no `constructor()` in it. As said previously, that's the same as if there was an empty constructor with only `super(...args)`.
370370

@@ -545,7 +545,7 @@ Here's the demo of a wrong `super` result after copying:
545545
```js run
546546
let animal = {
547547
sayHi() {
548-
console.log(`I'm an animal`);
548+
alert(`I'm an animal`);
549549
}
550550
};
551551
@@ -559,7 +559,7 @@ let rabbit = {
559559
560560
let plant = {
561561
sayHi() {
562-
console.log("I'm a plant");
562+
alert("I'm a plant");
563563
}
564564
};
565565

0 commit comments

Comments
 (0)