Skip to content

Commit ceb4fac

Browse files
committed
merging all conflicts
2 parents d66a263 + 035c526 commit ceb4fac

File tree

116 files changed

+2746
-725
lines changed

Some content is hidden

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

116 files changed

+2746
-725
lines changed

Diff for: .github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: iliakan

Diff for: 1-js/01-getting-started/3-code-editors/article.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ The main difference between a "lightweight editor" and an "IDE" is that an IDE w
2929

3030
In practice, lightweight editors may have a lot of plugins including directory-level syntax analyzers and autocompleters, so there's no strict border between a lightweight editor and an IDE.
3131

32-
The following options deserve your attention:
32+
There are many options, for instance:
3333

34-
- [Sublime Text](http://www.sublimetext.com) (cross-platform, shareware).
34+
- [Sublime Text](https://www.sublimetext.com/) (cross-platform, shareware).
3535
- [Notepad++](https://notepad-plus-plus.org/) (Windows, free).
36-
- [Vim](http://www.vim.org/) and [Emacs](https://www.gnu.org/software/emacs/) are also cool if you know how to use them.
36+
- [Vim](https://www.vim.org/) and [Emacs](https://www.gnu.org/software/emacs/) are also cool if you know how to use them.
3737

3838
## Let's not argue
3939

@@ -42,3 +42,8 @@ The editors in the lists above are those that either I or my friends whom I cons
4242
There are other great editors in our big world. Please choose the one you like the most.
4343

4444
The choice of an editor, like any other tool, is individual and depends on your projects, habits, and personal preferences.
45+
46+
The author's personal opinion:
47+
48+
- I'd use [Visual Studio Code](https://code.visualstudio.com/) if I develop mostly frontend.
49+
- Otherwise, if it's mostly another language/platform and partially frontend, then consider other editors, such as XCode (Mac), Visual Studio (Windows) or Jetbrains family (Webstorm, PHPStorm, RubyMine etc, depending on the language).

Diff for: 1-js/02-first-steps/04-variables/3-uppercast-constant/task.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ const birthday = '18.04.1982';
1212
const age = someCode(birthday);
1313
```
1414

15-
Here we have a constant `birthday` date and the `age` is calculated from `birthday` with the help of some code (it is not provided for shortness, and because details don't matter here).
15+
Here we have a constant `birthday` for the date, and also the `age` constant.
16+
17+
The `age` is calculated from `birthday` using `someCode()`, which means a function call that we didn't explain yet (we will soon!), but the details don't matter here, the point is that `age` is calculated somehow based on the `birthday`.
1618

1719
Would it be right to use upper case for `birthday`? For `age`? Or even for both?
1820

1921
```js
20-
const BIRTHDAY = '18.04.1982'; // make uppercase?
22+
const BIRTHDAY = '18.04.1982'; // make birthday uppercase?
2123

22-
const AGE = someCode(BIRTHDAY); // make uppercase?
24+
const AGE = someCode(BIRTHDAY); // make age uppercase?
2325
```
24-

Diff for: 1-js/02-first-steps/04-variables/article.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,16 @@ In older scripts, you may also find another keyword: `var` instead of `let`:
8888
*!*var*/!* message = 'Hello';
8989
```
9090

91-
The `var` keyword is *almost* the same as `let`. It also declares a variable, but in a slightly different, "old-school" way.
91+
The `var` keyword is *almost* the same as `let`. It also declares a variable but in a slightly different, "old-school" way.
9292

93-
There are subtle differences between `let` and `var`, but they do not matter for us yet. We'll cover them in detail in the chapter <info:var>.
93+
There are subtle differences between `let` and `var`, but they do not matter to us yet. We'll cover them in detail in the chapter <info:var>.
9494
````
9595
9696
## A real-life analogy
9797
9898
We can easily grasp the concept of a "variable" if we imagine it as a "box" for data, with a uniquely-named sticker on it.
9999
100-
For instance, the variable `message` can be imagined as a box labeled `"message"` with the value `"Hello!"` in it:
100+
For instance, the variable `message` can be imagined as a box labelled `"message"` with the value `"Hello!"` in it:
101101
102102
![](variable.svg)
103103
@@ -151,11 +151,11 @@ So, we should declare a variable once and then refer to it without `let`.
151151
````
152152

153153
```smart header="Functional languages"
154-
It's interesting to note that there exist [functional](https://en.wikipedia.org/wiki/Functional_programming) programming languages, like [Scala](http://www.scala-lang.org/) or [Erlang](http://www.erlang.org/) that forbid changing variable values.
154+
It's interesting to note that there exist so-called [pure functional](https://en.wikipedia.org/wiki/Purely_functional_programming) programming languages, such as [Haskell](https://en.wikipedia.org/wiki/Haskell), that forbid changing variable values.
155155
156156
In such languages, once the value is stored "in the box", it's there forever. If we need to store something else, the language forces us to create a new box (declare a new variable). We can't reuse the old one.
157157
158-
Though it may seem a little odd at first sight, these languages are quite capable of serious development. More than that, there are areas like parallel computations where this limitation confers certain benefits. Studying such a language (even if you're not planning to use it soon) is recommended to broaden the mind.
158+
Though it may seem a little odd at first sight, these languages are quite capable of serious development. More than that, there are areas like parallel computations where this limitation confers certain benefits.
159159
```
160160

161161
## Variable naming [#variable-naming]
@@ -198,14 +198,14 @@ Variables named `apple` and `APPLE` are two different variables.
198198
```
199199

200200
````smart header="Non-Latin letters are allowed, but not recommended"
201-
It is possible to use any language, including cyrillic letters or even hieroglyphs, like this:
201+
It is possible to use any language, including Cyrillic letters, Chinese logograms and so on, like this:
202202
203203
```js
204204
let имя = '...';
205205
let 我 = '...';
206206
```
207207
208-
Technically, there is no error here. Such names are allowed, but there is an international convention to use English in variable names. Even if we're writing a small script, it may have a long life ahead. People from other countries may need to read it some time.
208+
Technically, there is no error here. Such names are allowed, but there is an international convention to use English in variable names. Even if we're writing a small script, it may have a long life ahead. People from other countries may need to read it sometime.
209209
````
210210

211211
````warn header="Reserved names"
@@ -260,11 +260,11 @@ const myBirthday = '18.04.1982';
260260
myBirthday = '01.01.2001'; // error, can't reassign the constant!
261261
```
262262
263-
When a programmer is sure that a variable will never change, they can declare it with `const` to guarantee and clearly communicate that fact to everyone.
263+
When a programmer is sure that a variable will never change, they can declare it with `const` to guarantee and communicate that fact to everyone.
264264
265265
### Uppercase constants
266266
267-
There is a widespread practice to use constants as aliases for difficult-to-remember values that are known prior to execution.
267+
There is a widespread practice to use constants as aliases for difficult-to-remember values that are known before execution.
268268
269269
Such constants are named using capital letters and underscores.
270270
@@ -289,15 +289,15 @@ Benefits:
289289
290290
When should we use capitals for a constant and when should we name it normally? Let's make that clear.
291291
292-
Being a "constant" just means that a variable's value never changes. But there are constants that are known prior to execution (like a hexadecimal value for red) and there are constants that are *calculated* in run-time, during the execution, but do not change after their initial assignment.
292+
Being a "constant" just means that a variable's value never changes. But some constants are known before execution (like a hexadecimal value for red) and some constants are *calculated* in run-time, during the execution, but do not change after their initial assignment.
293293
294294
For instance:
295295
296296
```js
297297
const pageLoadTime = /* time taken by a webpage to load */;
298298
```
299299
300-
The value of `pageLoadTime` is not known prior to the page load, so it's named normally. But it's still a constant because it doesn't change after assignment.
300+
The value of `pageLoadTime` is not known before the page load, so it's named normally. But it's still a constant because it doesn't change after the assignment.
301301
302302
In other words, capital-named constants are only used as aliases for "hard-coded" values.
303303
@@ -307,18 +307,18 @@ Talking about variables, there's one more extremely important thing.
307307
308308
A variable name should have a clean, obvious meaning, describing the data that it stores.
309309
310-
Variable naming is one of the most important and complex skills in programming. A quick glance at variable names can reveal which code was written by a beginner versus an experienced developer.
310+
Variable naming is one of the most important and complex skills in programming. A glance at variable names can reveal which code was written by a beginner versus an experienced developer.
311311
312-
In a real project, most of the time is spent modifying and extending an existing code base rather than writing something completely separate from scratch. When we return to some code after doing something else for a while, it's much easier to find information that is well-labeled. Or, in other words, when the variables have good names.
312+
In a real project, most of the time is spent modifying and extending an existing code base rather than writing something completely separate from scratch. When we return to some code after doing something else for a while, it's much easier to find information that is well-labelled. Or, in other words, when the variables have good names.
313313
314314
Please spend time thinking about the right name for a variable before declaring it. Doing so will repay you handsomely.
315315
316316
Some good-to-follow rules are:
317317
318318
- Use human-readable names like `userName` or `shoppingCart`.
319-
- Stay away from abbreviations or short names like `a`, `b`, `c`, unless you really know what you're doing.
319+
- Stay away from abbreviations or short names like `a`, `b`, and `c`, unless you know what you're doing.
320320
- Make names maximally descriptive and concise. Examples of bad names are `data` and `value`. Such names say nothing. It's only okay to use them if the context of the code makes it exceptionally obvious which data or value the variable is referencing.
321-
- Agree on terms within your team and in your own mind. If a site visitor is called a "user" then we should name related variables `currentUser` or `newUser` instead of `currentVisitor` or `newManInTown`.
321+
- Agree on terms within your team and in your mind. If a site visitor is called a "user" then we should name related variables `currentUser` or `newUser` instead of `currentVisitor` or `newManInTown`.
322322
323323
Sounds simple? Indeed it is, but creating descriptive and concise variable names in practice is not. Go for it.
324324

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

+1-8
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,6 @@ const bigInt = 1234567890123456789012345678901234567890n;
9494

9595
As `BigInt` numbers are rarely needed, we don't cover them here, but devoted them a separate chapter <info:bigint>. Read it when you need such big numbers.
9696
97-
98-
```smart header="Compatibility issues"
99-
Right now, `BigInt` is supported in Firefox/Chrome/Edge/Safari, but not in IE.
100-
```
101-
102-
You can check [*MDN* BigInt compatibility table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#Browser_compatibility) to know which versions of a browser are supported.
103-
10497
## String
10598
10699
A string in JavaScript must be surrounded by quotes.
@@ -224,7 +217,7 @@ The `symbol` type is used to create unique identifiers for objects. We have to m
224217

225218
## The typeof operator [#type-typeof]
226219

227-
The `typeof` operator returns the type of the argument. It's useful when we want to process values of different types differently or just want to do a quick check.
220+
The `typeof` operator returns the type of the operand. It's useful when we want to process values of different types differently or just want to do a quick check.
228221

229222
A call to `typeof x` returns a string with the type name:
230223

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ String conversion is mostly obvious. A `false` becomes `"false"`, `null` becomes
3434

3535
## Numeric Conversion
3636

37-
Numeric conversion happens in mathematical functions and expressions automatically.
37+
Numeric conversion in mathematical functions and expressions happens automatically.
3838

3939
For example, when division `/` is applied to non-numbers:
4040

Diff for: 1-js/02-first-steps/08-operators/3-primitive-conversions-questions/solution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ undefined + 1 = NaN // (6)
2222
4. The subtraction always converts to numbers, so it makes `" -9 "` a number `-9` (ignoring spaces around it).
2323
5. `null` becomes `0` after the numeric conversion.
2424
6. `undefined` becomes `NaN` after the numeric conversion.
25-
7. Space characters, are trimmed off string start and end when a string is converted to a number. Here the whole string consists of space characters, such as `\t`, `\n` and a "regular" space between them. So, similarly to an empty string, it becomes `0`.
25+
7. Space characters are trimmed off string start and end when a string is converted to a number. Here the whole string consists of space characters, such as `\t`, `\n` and a "regular" space between them. So, similarly to an empty string, it becomes `0`.

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

+6-5
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ The result of `a % b` is the [remainder](https://en.wikipedia.org/wiki/Remainder
5050
For instance:
5151

5252
```js run
53-
alert( 5 % 2 ); // 1, a remainder of 5 divided by 2
54-
alert( 8 % 3 ); // 2, a remainder of 8 divided by 3
53+
alert( 5 % 2 ); // 1, the remainder of 5 divided by 2
54+
alert( 8 % 3 ); // 2, the remainder of 8 divided by 3
55+
alert( 8 % 4 ); // 0, the remainder of 8 divided by 4
5556
```
5657

5758
### Exponentiation **
@@ -68,7 +69,7 @@ alert( 2 ** 3 ); // 2³ = 8
6869
alert( 2 ** 4 ); // 2⁴ = 16
6970
```
7071

71-
Just like in maths, the exponentiation operator is defined for non-integer numbers as well.
72+
Just like in maths, the exponentiation operator is defined for non-integer numbers as well.
7273

7374
For example, a square root is an exponentiation by ½:
7475

@@ -80,7 +81,7 @@ alert( 8 ** (1/3) ); // 2 (power of 1/3 is the same as a cubic root)
8081

8182
## String concatenation with binary +
8283

83-
Let's meet features of JavaScript operators that are beyond school arithmetics.
84+
Let's meet the features of JavaScript operators that are beyond school arithmetics.
8485
8586
Usually, the plus operator `+` sums numbers.
8687
@@ -305,7 +306,7 @@ let n = 2;
305306
306307
n *= 3 + 5; // right part evaluated first, same as n *= 8
307308
308-
alert( n ); // 16
309+
alert( n ); // 16
309310
```
310311

311312
## Increment/decrement

Diff for: 1-js/02-first-steps/10-ifelse/article.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ if (cond) {
6868

6969
## The "else" clause
7070

71-
The `if` statement may contain an optional "else" block. It executes when the condition is falsy.
71+
The `if` statement may contain an optional `else` block. It executes when the condition is falsy.
7272

7373
For example:
7474
```js run
@@ -181,9 +181,9 @@ alert( message );
181181
It may be difficult at first to grasp what's going on. But after a closer look, we can see that it's just an ordinary sequence of tests:
182182

183183
1. The first question mark checks whether `age < 3`.
184-
2. If true -- it returns `'Hi, baby!'`. Otherwise, it continues to the expression after the colon '":"', checking `age < 18`.
185-
3. If that's true -- it returns `'Hello!'`. Otherwise, it continues to the expression after the next colon '":"', checking `age < 100`.
186-
4. If that's true -- it returns `'Greetings!'`. Otherwise, it continues to the expression after the last colon '":"', returning `'What an unusual age!'`.
184+
2. If true -- it returns `'Hi, baby!'`. Otherwise, it continues to the expression after the colon ":", checking `age < 18`.
185+
3. If that's true -- it returns `'Hello!'`. Otherwise, it continues to the expression after the next colon ":", checking `age < 100`.
186+
4. If that's true -- it returns `'Greetings!'`. Otherwise, it continues to the expression after the last colon ":", returning `'What an unusual age!'`.
187187

188188
Here's how this looks using `if..else`:
189189

Diff for: 1-js/02-first-steps/12-nullish-coalescing-operator/article.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ For example, here we show `user` if its value isn't `null/undefined`, otherwise
2929
```js run
3030
let user;
3131

32-
alert(user ?? "Anonymous"); // Anonymous (user not defined)
32+
alert(user ?? "Anonymous"); // Anonymous (user is undefined)
3333
```
3434
3535
Here's the example with `user` assigned to a name:
3636
3737
```js run
3838
let user = "John";
3939

40-
alert(user ?? "Anonymous"); // John (user defined)
40+
alert(user ?? "Anonymous"); // John (user is not null/undefined)
4141
```
4242
4343
We can also use a sequence of `??` to select the first value from a list that isn't `null/undefined`.
@@ -76,7 +76,7 @@ alert(firstName || lastName || nickName || "Anonymous"); // Supercoder
7676
*/!*
7777
```
7878
79-
Historically, the OR `||` operator was there first. It exists since the beginning of JavaScript, so developers were using it for such purposes for a long time.
79+
Historically, the OR `||` operator was there first. It's been there since the beginning of JavaScript, so developers were using it for such purposes for a long time.
8080
8181
On the other hand, the nullish coalescing operator `??` was added to JavaScript only recently, and the reason for that was that people weren't quite happy with `||`.
8282

Diff for: 1-js/02-first-steps/15-function-basics/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function showMessage(from, text) {
265265
266266
### Alternative default parameters
267267
268-
Sometimes it makes sense to assign default values for parameters not in the function declaration, but at a later stage.
268+
Sometimes it makes sense to assign default values for parameters at a later stage after the function declaration.
269269
270270
We can check if the parameter is passed during the function execution, by comparing it with `undefined`:
271271
@@ -460,7 +460,7 @@ These examples assume common meanings of prefixes. You and your team are free to
460460
```smart header="Ultrashort function names"
461461
Functions that are used *very often* sometimes have ultrashort names.
462462

463-
For example, the [jQuery](http://jquery.com) framework defines a function with `$`. The [Lodash](http://lodash.com/) library has its core function named `_`.
463+
For example, the [jQuery](https://jquery.com/) framework defines a function with `$`. The [Lodash](https://lodash.com/) library has its core function named `_`.
464464

465465
These are exceptions. Generally function names should be concise and descriptive.
466466
```

Diff for: 1-js/02-first-steps/16-function-expressions/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ let sayHi = function() { // (1) create
8282
alert( "Hello" );
8383
};
8484

85-
let func = sayHi;
85+
let func = sayHi; //(2)
8686
// ...
8787
```
8888

Diff for: 1-js/02-first-steps/18-javascript-specials/article.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ More in: <info:variables> and <info:types>.
103103

104104
We're using a browser as a working environment, so basic UI functions will be:
105105

106-
[`prompt(question, [default])`](mdn:api/Window/prompt)
106+
[`prompt(question, [default])`](https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt)
107107
: Ask a `question`, and return either what the visitor entered or `null` if they clicked "cancel".
108108

109-
[`confirm(question)`](mdn:api/Window/confirm)
109+
[`confirm(question)`](https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm)
110110
: Ask a `question` and suggest to choose between Ok and Cancel. The choice is returned as `true/false`.
111111

112-
[`alert(message)`](mdn:api/Window/alert)
112+
[`alert(message)`](https://developer.mozilla.org/en-US/docs/Web/API/Window/alert)
113113
: Output a `message`.
114114

115115
All these functions are *modal*, they pause the code execution and prevent the visitor from interacting with the page until they answer.
@@ -144,7 +144,7 @@ Assignments
144144
: There is a simple assignment: `a = b` and combined ones like `a *= 2`.
145145

146146
Bitwise
147-
: Bitwise operators work with 32-bit integers at the lowest, bit-level: see the [docs](mdn:/JavaScript/Guide/Expressions_and_Operators#bitwise_operators) when they are needed.
147+
: Bitwise operators work with 32-bit integers at the lowest, bit-level: see the [docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#bitwise_operators) when they are needed.
148148

149149
Conditional
150150
: The only operator with three parameters: `cond ? resultA : resultB`. If `cond` is truthy, returns `resultA`, otherwise `resultB`.

0 commit comments

Comments
 (0)