Skip to content

Commit 48acfe1

Browse files
authored
Update article.md
1 parent bb08d4f commit 48acfe1

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

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

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Coding Style
1+
# Код стили боюнча кеңештер
22

3-
Our code must be as clean and easy to read as possible.
3+
Биздин код мүмкүн болушунча түшүнүктүү жана окууга оңой болушу керек.
44

5-
That is actually the art of programming -- to take a complex task and code it in a way that is both correct and human-readable. A good code style greatly assists in that.
5+
Чындыгында программалоо чеберчилиги -- бул татаал тапшырманы аткаруу жана аны туура жана адамга түшүнүктүү кылып коддоо. Жакшы код стили буга чоң жардам берет.
66

7-
## Syntax
7+
## Синтаксис
88

9-
Here is a cheat sheet with some suggested rules (see below for more details):
9+
Кээ бир сунушталган эрежелер бул сүрөттө келтирилген (кененирээк маалымат үчүн төмөндө караңыз):
1010

1111
![](code-style.svg)
1212
<!--
@@ -34,79 +34,79 @@ if (n < 0) {
3434
3535
-->
3636

37-
Now let's discuss the rules and reasons for them in detail.
37+
Эми алардын эрежелерин жана себептерин кененирээк караштыралы.
3838

39-
```warn header="There are no \"you must\" rules"
40-
Nothing is set in stone here. These are style preferences, not religious dogmas.
39+
```warn header="Милдеттүү эрежелер жок"
40+
Бул жерде эч кандай темирдей эрежелер жок. Булар стилдик артыкчылыктар, диний догмалар эмес.
4141
```
4242

43-
### Curly Braces
43+
### Фигуралык кашаалар
4444

4545
In most JavaScript projects curly braces are written in "Egyptian" style with the opening brace on the same line as the corresponding keyword -- not on a new line. There should also be a space before the opening bracket, like this:
4646

4747
```js
4848
if (condition) {
49-
// do this
50-
// ...and that
51-
// ...and that
49+
// муну кыл
50+
// ...муну дагы
51+
// ...муну дагы
5252
}
5353
```
5454

5555
A single-line construct, such as `if (condition) doSomething()`, is an important edge case. Should we use braces at all?
5656

5757
Here are the annotated variants so you can judge their readability for yourself:
5858

59-
1. 😠 Beginners sometimes do that. Bad! Curly braces are not needed:
59+
1. 😠 Кээде үйрөнчүктөр ушундай кылышат. Бул жаман мисал, фигуралык кашаалардын кереги жок:
6060
```js
61-
if (n < 0) *!*{*/!*alert(`Power ${n} is not supported`);*!*}*/!*
61+
if (n < 0) *!*{*/!*alert(`${n} даражасы колдоого алынбайт`);*!*}*/!*
6262
```
63-
2. 😠 Split to a separate line without braces. Never do that, easy to make an error when adding new lines:
63+
2. 😠 Фигуралык кашаасыз саптарды эч качан бөлбөңүз - жаңы саптарды кошуп жатканда кокустан ката кетиши мүмкүн:
6464
```js
6565
if (n < 0)
66-
alert(`Power ${n} is not supported`);
66+
alert(`${n} даражасы колдоого алынбайт`);
6767
```
68-
3. 😏 One line without braces - acceptable, if it's short:
68+
3. 😏 Кашаасыз бир сапка жазуу - алгылыктуу вариант, эгерде сап кыска болсо:
6969
```js
70-
if (n < 0) alert(`Power ${n} is not supported`);
70+
if (n < 0) alert(`${n} даражасы колдоого алынбайт`);
7171
```
72-
4. 😃 The best variant:
72+
4. 😃 Мыкты вариант:
7373
```js
7474
if (n < 0) {
75-
alert(`Power ${n} is not supported`);
75+
alert(`${n} даражасы колдоого алынбайт`);
7676
}
7777
```
7878
7979
For a very brief code, one line is allowed, e.g. `if (cond) return null`. But a code block (the last variant) is usually more readable.
8080
81-
### Line Length
81+
### Саптын узундугу
8282
8383
No one likes to read a long horizontal line of code. It's best practice to split them.
8484
85-
For example:
85+
Мисалы:
8686
```js
87-
// backtick quotes ` allow to split the string into multiple lines
87+
// тескери тырмакча ` сапты бир нече бөлүктөргө бөлүүгө мүмкүндүк берет
8888
let str = `
89-
ECMA International's TC39 is a group of JavaScript developers,
90-
implementers, academics, and more, collaborating with the community
91-
to maintain and evolve the definition of JavaScript.
89+
ECMA International уюмунун TC39 жумушчу тобу - бул JavaScript тилин
90+
колдоо жана өнүктүрүү үчүн коомдоштук менен биргелешип иштешкен JavaScript
91+
иштеп чыгуучулардын, интеграция боюнча адистердин, илимпоздордун ж.б. тобу.
9292
`;
9393
```
9494
95-
And, for `if` statements:
95+
Же `if` үчүн:
9696
9797
```js
9898
if (
9999
id === 123 &&
100-
moonPhase === 'Waning Gibbous' &&
101-
zodiacSign === 'Libra'
100+
moonPhase === 'Өсүп жаткан ай' &&
101+
zodiacSign === 'Тараза'
102102
) {
103103
letTheSorceryBegin();
104104
}
105105
```
106106
107107
The maximum line length should be agreed upon at the team-level. It's usually 80 or 120 characters.
108108
109-
### Indents
109+
### Чегинүүлөр
110110
111111
There are two types of indents:
112112

0 commit comments

Comments
 (0)