Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coding style #59

Merged
merged 27 commits into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c0db2c2
Translate Code Style section
alexgalkin Feb 26, 2020
48299ae
Fixed mistake in solution translation
alexgalkin Feb 26, 2020
593e2e1
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
b719b94
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
3f363f2
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
f6ea17d
Fix minor typos and mistakes
alexgalkin Feb 26, 2020
466d476
Merge branch 'master' of github.com:alexgalkin/uk.javascript.info
alexgalkin Feb 26, 2020
4f4e0cb
Fix minor typos and mistakes
alexgalkin Feb 26, 2020
d8bd044
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
aa0e0ce
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
74d9c97
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
11aaeb4
Fix mistakes according to the review
alexgalkin Feb 26, 2020
0998cd2
one more minor correction
alexgalkin Feb 26, 2020
ee977f1
Translate Code Style section
alexgalkin Feb 26, 2020
f3b11a3
Fixed mistake in solution translation
alexgalkin Feb 26, 2020
cbcfd03
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
edc13e6
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
f2c65f6
Fix minor typos and mistakes
alexgalkin Feb 26, 2020
9684e5d
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
0ba48b6
Fix minor typos and mistakes
alexgalkin Feb 26, 2020
d4269aa
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
33bf37f
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
8096324
Update 1-js/03-code-quality/02-coding-style/article.md
alexgalkin Feb 26, 2020
5b3d4c0
Fix mistakes according to the review
alexgalkin Feb 26, 2020
4788310
one more minor correction
alexgalkin Feb 26, 2020
d6a4af5
Merge branch 'master' of github.com:alexgalkin/uk.javascript.info
alexgalkin Feb 26, 2020
cdd5a3a
minor fix
alexgalkin Feb 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions 1-js/03-code-quality/02-coding-style/1-style-errors/solution.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@

You could note the following:
Ви можете зробити наступні відмітки:

```js no-beautify
function pow(x,n) // <- no space between arguments
{ // <- figure bracket on a separate line
let result=1; // <- no spaces before or after =
for(let i=0;i<n;i++) {result*=x;} // <- no spaces
// the contents of { ... } should be on a new line
function pow(x,n) // <- немає пробілу між аргументами
{ // <- фігурна дужка на окремому рядку
let result=1; // <- немає пробілу до і після знаку =
for(let i=0;i<n;i++) {result*=x;} // <- немає пробілів
// те, що міститься у дужках { ... } повинно бути в окремому рядку
return result;
}

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

The fixed variant:
Виправлений варіант:

```js
function pow(x, n) {
Expand Down
6 changes: 3 additions & 3 deletions 1-js/03-code-quality/02-coding-style/1-style-errors/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 4

---

# Bad style
# Поганий стиль

What's wrong with the code style below?
Що не так у стилі коду наведеному нижче?

```js no-beautify
function pow(x,n)
Expand All @@ -25,4 +25,4 @@ else
}
```

Fix it.
Виправте його.
Loading