Skip to content

Commit 5e69052

Browse files
author
root
committed
merging all conflicts
2 parents d2d96cd + 9b5c1c9 commit 5e69052

File tree

64 files changed

+465
-447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+465
-447
lines changed

1-js/01-getting-started/1-intro/article.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,25 @@ Javascript – це єдина браузерна технологія, яка
105105

106106
Сучасні інструменти роблять транспіляцію дуже швидкою і прозорою, дозволяючи розробникам писати код іншою мовою і автоматично конвертувати його "під капотом".
107107

108+
<<<<<<< HEAD
108109
Приклади таких мов:
109110

110111
- [CoffeeScript](http://coffeescript.org/) це "синтаксичний цукор" поверх JavaScript. Вона вводить більш короткий синтаксис, дозволяючи нам писати більш чіткий і точний код. Зазвичай, програмісти на Ruby люблять її.
111112
- [TypeScript](http://www.typescriptlang.org/) зосереджена на додаванні "строгої типізації даних", щоб спростити розробку і підтримку складних систем. ЇЇ розробляє Microsoft.
112113
- [Dart](https://www.dartlang.org/) це автономна мова, яка має власний рушій, який виконується в не-браузерних середовищах (таких як, мобільні застосунки). Спочатку компанія Google запропонувала її як заміну JavaScript, але на даний момент, браузери використовують її для транспіляції в JavaScript так само, як інструменти вище.
113114

114115
Їх є ще більше. Звичайно, навіть якщо ми використовуємо одну з цих мов, ми також повинні знати JavaScript, щоб дійсно розуміти, що робимо.
116+
=======
117+
The most used are
118+
Examples of such languages:
119+
120+
- [CoffeeScript](http://coffeescript.org/) is a "syntactic sugar" for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it.
121+
- [TypeScript](http://www.typescriptlang.org/) is concentrated on adding "strict data typing" to simplify the development and support of complex systems. It is developed by Microsoft.
122+
- [Flow](http://flow.org/) also adds data typing, but in a different way. Developed by Facebook.
123+
- [Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google.
124+
125+
There are more. Of course, even if we use one of transpiled languages, we should also know JavaScript to really understand what we're doing.
126+
>>>>>>> 9b5c1c95ec8a466150e519b0e94748717c747b09
115127
116128
## Підсумки
117129

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
# Manuals and specifications
3+
4+
This book is a *tutorial*. It aims to help you gradually learn the language. But once you're familiar with the basics, you'll need other sources.
5+
6+
7+
## Specification
8+
9+
**The ECMA-262 specification** contains the most in-depth, detailed and formalized information about JavaScript. It defines the language.
10+
11+
But being that formalized, it's difficult to understand at first. So if you need the most trustworthy source of information about the language details, it's the right place. But it's not for everyday use.
12+
13+
The latest draft is at <https://tc39.es/ecma262/>.
14+
15+
To read about bleeding-edge features, that are not yet widely supported, see proposals at <https://github.com/tc39/proposals>.
16+
17+
Also, if you're in developing for the browser, then there are other specs covered in the [second part](info:browser-environment) of the tutorial.
18+
19+
## Manuals
20+
21+
- **MDN (Mozilla) JavaScript Reference** is a manual with examples and other information. It's great to get in-depth information about individual language functions, methods etc.
22+
23+
One can find it at <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.
24+
25+
Although, it's often best to use an internet search instead. Just use "MDN [term]" in the query, e.g. <https://google.com/search?q=MDN+parseInt> to search for `parseInt` function.
26+
27+
28+
- **MSDN** – Microsoft manual with a lot of information, including JavaScript (often referrerd to as JScript). If one needs something specific to Internet Explorer, better go there: <http://msdn.microsoft.com/>.
29+
30+
Also, we can use an internet search with phrases such as "RegExp MSDN" or "RegExp MSDN jscript".
31+
32+
## Feature support
33+
34+
JavaScript is a developing language, new features get added regularly.
35+
36+
To see their support among browser-based and other engines, see:
37+
38+
- <http://caniuse.com> - per-feature tables of support, e.g. to see which engines support modern cryptography functions: <http://caniuse.com/#feat=cryptography>.
39+
- <https://kangax.github.io/compat-table> - a table with language features and engines that support those or don't support.
40+
41+
All these resources are useful in real-life development, as they contain valuable information about language details, their support etc.
42+
43+
Please remember them (or this page) for the cases when you need in-depth information about a particular feature.

1-js/03-code-quality/02-coding-style/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ Here's an example of an `.eslintrc` file:
304304
},
305305
"rules": {
306306
"no-console": 0,
307-
},
308-
"indent": 2
307+
"indent": ["warning", 2]
308+
}
309309
}
310310
```
311311

1-js/04-object-basics/03-symbol/article.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ alert(id.description); // id
7474

7575
Symbols allow us to create "hidden" properties of an object, that no other part of code can occasionally access or overwrite.
7676

77-
For instance, if we'd like to add an "identifier" to the object `user`, we can use a symbol as a key for it:
77+
For instance, if we're working with `user` objects, that belong to a third-party code and don't have any `id` field. We'd like to add identifiers to them.
78+
79+
Let's use a symbol key for it:
7880

7981
```js run
8082
let user = { name: "John" };
@@ -86,9 +88,9 @@ alert( user[id] ); // we can access the data using the symbol as the key
8688

8789
What's the benefit of using `Symbol("id")` over a string `"id"`?
8890

89-
Let's make the example a bit deeper to see that.
91+
As `user` objects belongs to another code, and that code also works with them, we shouldn't just add any fields to it. That's unsafe. But a symbol cannot be accessed occasionally, the third-party code probably won't even see it, so it's probably all right to do.
9092

91-
Imagine that another script wants to have its own identifier inside `user`, for its own purposes. That may be another JavaScript library, so thes scripts are completely unaware of each other.
93+
Also, imagine that another script wants to have its own identifier inside `user`, for its own purposes. That may be another JavaScript library, so that the scripts are completely unaware of each other.
9294

9395
Then that script can create its own `Symbol("id")`, like this:
9496

1-js/04-object-basics/04-object-methods/2-check-syntax/solution.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ The error message in most browsers does not give understanding what went wrong.
1515

1616
**The error appears because a semicolon is missing after `user = {...}`.**
1717

18-
JavaScript does not assume a semicolon before a bracket `(user.go)()`, so it reads the code like:
18+
JavaScript does not auto-insert a semicolon before a bracket `(user.go)()`, so it reads the code like:
1919

2020
```js no-beautify
2121
let user = { go:... }(user.go)()
2222
```
2323

24-
Then we can also see that such a joint expression is syntactically a call of the object `{ go: ... }` as a function with the argument `(user.go)`. And that also happens on the same line with `let user`, so the `user` object has not yet even been defined, hence the error.
24+
Then we can also see that such a joint expression is syntactically a call of the object `{ go: ... }` as a function with the argument `(user.go)`. And that also happens on the same line with `let user`, so the `user` object has not yet even been defined, hence the error.
2525

2626
If we insert the semicolon, all is fine:
2727

@@ -35,9 +35,3 @@ let user = {
3535
```
3636

3737
Please note that brackets around `(user.go)` do nothing here. Usually they setup the order of operations, but here the dot `.` works first anyway, so there's no effect. Only the semicolon thing matters.
38-
39-
40-
41-
42-
43-

1-js/04-object-basics/04-object-methods/4-object-property-this/solution.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ let user = makeUser();
1414
alert( user.ref.name ); // Error: Cannot read property 'name' of undefined
1515
```
1616

17-
That's because rules that set `this` do not look at object literals.
17+
That's because rules that set `this` do not look at object definition. Only the moment of call matters.
1818

19-
Here the value of `this` inside `makeUser()` is `undefined`, because it is called as a function, not as a method.
19+
Here the value of `this` inside `makeUser()` is `undefined`, because it is called as a function, not as a method with "dot" syntax.
2020

21-
And the object literal itself has no effect on `this`. The value of `this` is one for the whole function, code blocks and object literals do not affect it.
21+
The value of `this` is one for the whole function, code blocks and object literals do not affect it.
2222

2323
So `ref: this` actually takes current `this` of the function.
2424

@@ -42,5 +42,3 @@ alert( user.ref().name ); // John
4242
```
4343

4444
Now it works, because `user.ref()` is a method. And the value of `this` is set to the object before dot `.`.
45-
46-

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Actions are represented in JavaScript by functions in properties.
1515

1616
## Method examples
1717

18-
For the start, let's teach the `user` to say hello:
18+
For a start, let's teach the `user` to say hello:
1919

2020
```js run
2121
let user = {
@@ -257,11 +257,11 @@ user.hi(); // John (the simple call works)
257257
*/!*
258258
```
259259
260-
On the last line there is a ternary operator that chooses either `user.hi` or `user.bye`. In this case the result is `user.hi`.
260+
On the last line there is a conditinal operator that chooses either `user.hi` or `user.bye`. In this case the result is `user.hi`.
261261
262-
The method is immediately called with parentheses `()`. But it doesn't work right!
262+
Then the method is immediately called with parentheses `()`. But it doesn't work right!
263263
264-
You can see that the call results in an error, because the value of `"this"` inside the call becomes `undefined`.
264+
As you can see, the call results in an error, because the value of `"this"` inside the call becomes `undefined`.
265265
266266
This works (object dot method):
267267
```js
@@ -306,7 +306,7 @@ The Reference Type is a "specification type". We can't explicitly use it, but it
306306
The value of Reference Type is a three-value combination `(base, name, strict)`, where:
307307
308308
- `base` is the object.
309-
- `name` is the property.
309+
- `name` is the property name.
310310
- `strict` is true if `use strict` is in effect.
311311
312312
The result of a property access `user.hi` is not a function, but a value of Reference Type. For `user.hi` in strict mode it is:
@@ -318,6 +318,8 @@ The result of a property access `user.hi` is not a function, but a value of Refe
318318
319319
When parentheses `()` are called on the Reference Type, they receive the full information about the object and its method, and can set the right `this` (`=user` in this case).
320320
321+
Reference type is a special "intermediary" internal type, with the purpose to pass information from dot `.` to calling parentheses `()`.
322+
321323
Any other operation like assignment `hi = user.hi` discards the reference type as a whole, takes the value of `user.hi` (a function) and passes it on. So any further operation "loses" `this`.
322324
323325
So, as the result, the value of `this` is only passed the right way if the function is called directly using a dot `obj.method()` or square brackets `obj['method']()` syntax (they do the same here). Later in this tutorial, we will learn various ways to solve this problem such as [func.bind()](/bind#solution-2-bind).

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We already know methods that add and remove items from the beginning or the end:
1111
- `arr.shift()` -- extracts an item from the beginning,
1212
- `arr.unshift(...items)` -- adds items to the beginning.
1313

14-
Here are few others.
14+
Here are a few others.
1515

1616
### splice
1717

@@ -238,7 +238,7 @@ These are methods to search for something in an array.
238238

239239
The methods [arr.indexOf](mdn:js/Array/indexOf), [arr.lastIndexOf](mdn:js/Array/lastIndexOf) and [arr.includes](mdn:js/Array/includes) have the same syntax and do essentially the same as their string counterparts, but operate on items instead of characters:
240240

241-
- `arr.indexOf(item, from)` looks for `item` starting from index `from`, and returns the index where it was found, otherwise `-1`.
241+
- `arr.indexOf(item, from)` -- looks for `item` starting from index `from`, and returns the index where it was found, otherwise `-1`.
242242
- `arr.lastIndexOf(item, from)` -- same, but looks for from right to left.
243243
- `arr.includes(item, from)` -- looks for `item` starting from index `from`, returns `true` if found.
244244

@@ -418,7 +418,7 @@ alert(arr); // *!*1, 2, 15*/!*
418418

419419
Now it works as intended.
420420

421-
Let's step aside and think what's happening. The `arr` can be array of anything, right? It may contain numbers or strings or html elements or whatever. We have a set of *something*. To sort it, we need an *ordering function* that knows how to compare its elements. The default is a string order.
421+
Let's step aside and think what's happening. The `arr` can be array of anything, right? It may contain numbers or strings or HTML elements or whatever. We have a set of *something*. To sort it, we need an *ordering function* that knows how to compare its elements. The default is a string order.
422422

423423
The `arr.sort(fn)` method has a built-in implementation of sorting algorithm. We don't need to care how it exactly works (an optimized [quicksort](https://en.wikipedia.org/wiki/Quicksort) most of the time). It will walk the array, compare its elements using the provided function and reorder them, all we need is to provide the `fn` which does the comparison.
424424

@@ -474,7 +474,7 @@ It also returns the array `arr` after the reversal.
474474

475475
### split and join
476476

477-
Here's the situation from the real life. We are writing a messaging app, and the person enters the comma-delimited list of receivers: `John, Pete, Mary`. But for us an array of names would be much more comfortable than a single string. How to get it?
477+
Here's the situation from real life. We are writing a messaging app, and the person enters the comma-delimited list of receivers: `John, Pete, Mary`. But for us an array of names would be much more comfortable than a single string. How to get it?
478478

479479
The [str.split(delim)](mdn:js/String/split) method does exactly that. It splits the string into an array by the given delimiter `delim`.
480480

@@ -548,7 +548,7 @@ So far, like `forEach/map`. But there's one more argument:
548548

549549
The easiest way to grasp that is by example.
550550

551-
Here we get a sum of array in one line:
551+
Here we get a sum of an array in one line:
552552

553553
```js run
554554
let arr = [1, 2, 3, 4, 5];
@@ -681,7 +681,7 @@ In the call above, we use `user.younger` as a filter and also provide `user` as
681681

682682
## Summary
683683

684-
A cheatsheet of array methods:
684+
A cheat sheet of array methods:
685685

686686
- To add/remove elements:
687687
- `push(...items)` -- adds items to the end,
@@ -727,6 +727,6 @@ For the full list, see the [manual](mdn:js/Array).
727727

728728
From the first sight it may seem that there are so many methods, quite difficult to remember. But actually that's much easier than it seems.
729729

730-
Look through the cheatsheet just to be aware of them. Then solve the tasks of this chapter to practice, so that you have experience with array methods.
730+
Look through the cheat sheet just to be aware of them. Then solve the tasks of this chapter to practice, so that you have experience with array methods.
731731

732-
Afterwards whenever you need to do something with an array, and you don't know how -- come here, look at the cheatsheet and find the right method. Examples will help you to write it correctly. Soon you'll automatically remember the methods, without specific efforts from your side.
732+
Afterwards whenever you need to do something with an array, and you don't know how -- come here, look at the cheat sheet and find the right method. Examples will help you to write it correctly. Soon you'll automatically remember the methods, without specific efforts from your side.

1-js/05-data-types/09-destructuring-assignment/1-destruct-user/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ Write the destructuring assignment that reads:
1717

1818
- `name` property into the variable `name`.
1919
- `years` property into the variable `age`.
20-
- `isAdmin` property into the variable `isAdmin` (false if absent)
20+
- `isAdmin` property into the variable `isAdmin` (false, if no such property)
2121

22-
The values after the assignment should be:
22+
Here's an example of the values after your assignment:
2323

2424
```js
2525
let user = { name: "John", years: 30 };

0 commit comments

Comments
 (0)