Skip to content

Commit 7019d14

Browse files
committed
up
1 parent 20784e7 commit 7019d14

File tree

48 files changed

+1018
-463
lines changed

Some content is hidden

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

48 files changed

+1018
-463
lines changed

1-js/02-first-steps/01-hello-world/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ The example above can be split into two scripts to work:
130130
131131
- We can use a `<script>` tag to add JavaScript code to the page.
132132
- The `type` and `language` attributes are not required.
133-
- Scripts in an external file can be inserted on the page via `<script src="https://github.com/path"></script>`.
133+
- A script in an external file can be inserted with `<script src="https://github.com/path%3Cspan%20class="x x-first x-last">/to/script.js"></script>`.
134134
135135
136136
There is much more about browser scripts and their interaction with the web-page. But let's keep in mind that this part of the tutorial is devoted to Javascript language. So we shouldn't distract ourselves from it. We'll be using a browser as a way to run Javascript, very convenient for online reading, but yet one of many.

1-js/02-first-steps/16-javascript-specials/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ let age = prompt('Your age?', 18);
218218
219219
switch (age) {
220220
case 18:
221-
alert("Won't work"); // the result of prompt is a string, not a number число
221+
alert("Won't work"); // the result of prompt is a string, not a number
222222
223223
case "18":
224224
alert("This works!"");
Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,48 @@
1-
# Ответ
21

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

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

14-
x=prompt("x?",'') // <- не объявлена переменная, нет пробелов, ;
15-
n=prompt("n?",'')
16-
if (n<0) // <- нет пробелов, стоит добавить вертикальную отбивку
17-
{ // <- фигурная скобка на отдельной строке
18-
// ниже - слишком длинная строка, нет пробелов
19-
alert('Степень '+n+'не поддерживается, введите целую степень, большую 0');
13+
let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
14+
// but better make it 2 lines, also there's no spaces and ;
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 - a long line, may be worth to split into 2 lines
18+
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
2019
}
21-
else // <- можно на одной строке } else {
20+
else // <- could write it on a single line like "} else {"
2221
{
23-
alert(pow(x,n)) // нет точки с запятой
22+
alert(pow(x,n)) // no spaces and ;
2423
}
2524
```
2625

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

2928
```js
3029
function pow(x, n) {
31-
var result = 1;
30+
let result = 1;
3231

33-
for (var i = 0; i < n; i++) {
32+
for (let i = 0; i < n; i++) {
3433
result *= x;
3534
}
3635

3736
return result;
3837
}
3938

40-
var x = prompt("x?", "");
41-
var n = prompt("n?", "");
39+
let x = prompt("x?", "");
40+
let n = prompt("n?", "");
4241

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

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ importance: 4
22

33
---
44

5-
# Ошибки в стиле
5+
# Bad style
66

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

99
```js no-beautify
1010
function pow(x,n)
1111
{
12-
var result=1;
13-
for(var i=0;i<n;i++) {result*=x;}
12+
let result=1;
13+
for(let i=0;i<n;i++) {result*=x;}
1414
return result;
1515
}
1616

17-
x=prompt("x?",'')
18-
n=prompt("n?",'')
17+
let x=prompt("x?",''), n=prompt("n?",'')
1918
if (n<=0)
2019
{
21-
alert('Степень '+n+'не поддерживается, введите целую степень, большую 0');
20+
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
2221
}
2322
else
2423
{
2524
alert(pow(x,n))
2625
}
2726
```
2827

28+
Fix it.

1-js/03-code-quality/05-testing/1-pow-nan-spec/_js.view/solution.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

1-js/03-code-quality/05-testing/1-pow-nan-spec/_js.view/source.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

1-js/03-code-quality/05-testing/1-pow-nan-spec/_js.view/test.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

1-js/03-code-quality/05-testing/1-pow-nan-spec/solution.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

1-js/03-code-quality/05-testing/1-pow-nan-spec/task.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

1-js/03-code-quality/05-testing/2-pow-test-0/solution.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

1-js/03-code-quality/05-testing/2-pow-test-0/solution.view/index.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

1-js/03-code-quality/05-testing/2-pow-test-0/solution.view/test.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

1-js/03-code-quality/05-testing/2-pow-test-0/source.view/index.html

Lines changed: 0 additions & 26 deletions
This file was deleted.

1-js/03-code-quality/05-testing/2-pow-test-0/source.view/test.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

1-js/03-code-quality/05-testing/2-pow-test-0/task.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)