Skip to content

Commit 1ca087a

Browse files
authored
Merge pull request #9 from javascript-tutorial/master
sync
2 parents d1bd248 + 3a151fe commit 1ca087a

File tree

267 files changed

+9987
-2847
lines changed

Some content is hidden

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

267 files changed

+9987
-2847
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

2-
Backticks embed the expression inside `${...}` into the string.
2+
Обратные кавычки позволяют вставить выражение внутри `${...}` в строку.
33

44
```js run
55
let name = "Ilya";
66

7-
// the expression is a number 1
7+
// выражение - число 1
88
alert( `hello ${1}` ); // hello 1
99

10-
// the expression is a string "name"
10+
// выражение - строка "name"
1111
alert( `hello ${"name"}` ); // hello name
1212

13-
// the expression is a variable, embed it
13+
// выражение - переменная, вставим её в строку
1414
alert( `hello ${name}` ); // hello Ilya
1515
```

1-js/02-first-steps/05-types/1-string-quotes/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# String quotes
5+
# Шаблонные строки
66

7-
What is the output of the script?
7+
Что выведет этот скрипт?
88

99
```js
1010
let name = "Ilya";
@@ -14,4 +14,4 @@ alert( `hello ${1}` ); // ?
1414
alert( `hello ${"name"}` ); // ?
1515

1616
alert( `hello ${name}` ); // ?
17-
```
17+
```

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

Lines changed: 96 additions & 96 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
The answer is:
1+
Ответ:
32

43
- `a = 2`
54
- `b = 2`
@@ -9,10 +8,10 @@ The answer is:
98
```js run no-beautify
109
let a = 1, b = 1;
1110

12-
alert( ++a ); // 2, prefix form returns the new value
13-
alert( b++ ); // 1, postfix form returns the old value
11+
alert( ++a ); // 2, префиксная форма возвращает новое значение
12+
alert( b++ ); // 1, постфиксная форма возвращает старое значение
1413

15-
alert( a ); // 2, incremented once
16-
alert( b ); // 2, incremented once
14+
alert( a ); // 2, значение увеличено один раз
15+
alert( b ); // 2, значение увеличено один раз
1716
```
1817

1-js/02-first-steps/07-operators/1-increment-order/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# The postfix and prefix forms
5+
# Постфиксная и префиксная формы
66

7-
What are the final values of all variables `a`, `b`, `c` and `d` after the code below?
7+
Чему будут равны переменные `a`, `b`, `c` и `d` в примере ниже?
88

99
```js
1010
let a = 1, b = 1;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
The answer is:
1+
Ответ:
22

3-
- `a = 4` (multiplied by 2)
4-
- `x = 5` (calculated as 1 + 4)
3+
- `a = 4` (умножено на 2)
4+
- `x = 5` (вычислено как 1 + 4)
55

1-js/02-first-steps/07-operators/2-assignment-result/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 3
22

33
---
44

5-
# Assignment result
5+
# Результат присваивания
66

7-
What are the values of `a` and `x` after the code below?
7+
Чему будут равны переменные `a` и `x` в примере ниже?
88

99
```js
1010
let a = 2;

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

Lines changed: 148 additions & 148 deletions
Large diffs are not rendered by default.

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

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

2-
You could note the following:
2+
Вы могли заметить следующие недостатки, сверху вниз:
33

44
```js no-beautify
5-
function pow(x,n) // <- no space between arguments
6-
{ // <- figure bracket on a separate line
7-
let result=1; // <- no spaces before or after =
8-
for(let i=0;i<n;i++) {result*=x;} // <- no spaces
9-
// the contents of { ... } should be on a new line
5+
function pow(x,n) // <- отсутствует пробел между аргументами
6+
{ // <- фигурная скобка на отдельной строке
7+
let result=1; // <- нет пробелов вокруг знака =
8+
for(let i=0;i<n;i++) {result*=x;} // <- нет пробелов
9+
// содержимое скобок { ... } лучше вынести на отдельную строку
1010
return result;
1111
}
1212

13-
let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
14-
// but better make it 2 lines, also there's no spaces and missing ;
15-
if (n<0) // <- no spaces inside (n < 0), and should be extra line above it
16-
{ // <- figure bracket on a separate line
17-
// below - long lines can be split into multiple lines for improved readability
18-
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
13+
let x=prompt("x?",''), n=prompt("n?",'') // <-- технически допустимо,
14+
// но лучше написать в 2 строки, также нет пробелов и точки с запятой
15+
if (n<0) // <- нет пробелов, стоит добавить отступ в одну строку сверху
16+
{ // <- фигурная скобка на отдельной строке
17+
// ниже - слишком длинная строка, лучше разбить для улучшения читаемости
18+
alert(`Степень ${n} не поддерживается, введите целую степень, большую 0`);
1919
}
20-
else // <- could write it on a single line like "} else {"
20+
else // <- можно на одной строке, вместе: "} else {"
2121
{
22-
alert(pow(x,n)) // no spaces and missing ;
22+
alert(pow(x,n)) // вложенный вызов функции, нет пробелов и точки с запятой
2323
}
2424
```
2525

26-
The fixed variant:
26+
Исправленный вариант:
2727

2828
```js
2929
function pow(x, n) {
@@ -40,8 +40,8 @@ let x = prompt("x?", "");
4040
let n = prompt("n?", "");
4141

4242
if (n < 0) {
43-
alert(`Power ${n} is not supported,
44-
please enter an integer number greater than zero`);
43+
alert(`Степень ${n} не поддерживается,
44+
введите целую степень, большую 0`);
4545
} else {
4646
alert( pow(x, n) );
4747
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 4
22

33
---
44

5-
# Bad style
5+
# Плохой стиль
66

7-
What's wrong with the code style below?
7+
Какие недостатки вы видите в стиле написания кода этого примера?
88

99
```js no-beautify
1010
function pow(x,n)
@@ -17,12 +17,10 @@ function pow(x,n)
1717
let x=prompt("x?",''), n=prompt("n?",'')
1818
if (n<=0)
1919
{
20-
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
20+
alert(`Степень ${n} не поддерживается, введите целую степень, большую 0`);
2121
}
2222
else
2323
{
2424
alert(pow(x,n))
2525
}
2626
```
27-
28-
Fix it.

0 commit comments

Comments
 (0)