From 7da20500b7b33ddb41aaeeff9f731e9c08b78c6f Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Thu, 27 Feb 2020 21:16:58 +0200 Subject: [PATCH 01/13] Start translation of the Comments section --- 1-js/03-code-quality/03-comments/article.md | 26 ++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index 29ba701f8..f1d8487ac 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -1,26 +1,26 @@ -# Comments +# Коментарі -As we know from the chapter , comments can be single-line: starting with `//` and multiline: `/* ... */`. +Як нам відомо з розідлу , коментарі можна писати як на одному рядку: починаючи його з `//` так і на декількох рядках відокрлюючи їх за допомогою `/* ... */`. -We normally use them to describe how and why the code works. +Зазвичай ми використовуємо коментарі для опису опису того як і чому наш код працює. -At first sight, commenting might be obvious, but novices in programming often use them wrongly. +На перший погляд, коментування може здаватись очевидним, проте початківці часто використовують їх неправильно. -## Bad comments +## Погані кометарі Novices tend to use comments to explain "what is going on in the code". Like this: ```js -// This code will do this thing (...) and that thing (...) -// ...and who knows what else... -very; -complex; -code; +// Цей код зробить це (...) а потім ось це (...) +// ...і хто знає що ще... +дуже; +складний; +код; ``` -But in good code, the amount of such "explanatory" comments should be minimal. Seriously, the code should be easy to understand without them. +Проте в якісному коді, кількість таких "пояснювальних" коментарів повинна бути мінімальною. Серйозно, код повинен бути зрозумілим без них. -There's a great rule about that: "if the code is so unclear that it requires a comment, then maybe it should be rewritten instead". +Є хороше правило з приводу цього: "якщо код настільки не зрозумілий, що потребує коментарів, можливо його краще переписати". ### Recipe: factor out functions @@ -160,7 +160,7 @@ Why is the task solved this way? Any subtle features of the code? Where they are used? : If the code has anything subtle and counter-intuitive, it's definitely worth commenting. -## Summary +## Підсумки An important sign of a good developer is comments: their presence and even their absence. From 2af745163adcefe2dea2e6d7f01f7b82fd932c04 Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Fri, 28 Feb 2020 02:18:47 +0200 Subject: [PATCH 02/13] continue translating comments --- 1-js/03-code-quality/03-comments/article.md | 54 ++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index f1d8487ac..0c6d1b43a 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -8,7 +8,7 @@ ## Погані кометарі -Novices tend to use comments to explain "what is going on in the code". Like this: +Початківці намагаються використовувати коментарі, щоб пояснити "що саме відбувається у коді". Наприклад: ```js // Цей код зробить це (...) а потім ось це (...) @@ -22,9 +22,9 @@ Novices tend to use comments to explain "what is going on in the code". Like thi Є хороше правило з приводу цього: "якщо код настільки не зрозумілий, що потребує коментарів, можливо його краще переписати". -### Recipe: factor out functions +### Рецепт: виносьте код у функції -Sometimes it's beneficial to replace a code piece with a function, like here: +Іноді має сенс замінити частину кода на функцію, наприклад: ```js function showPrimes(n) { @@ -32,7 +32,7 @@ function showPrimes(n) { for (let i = 2; i < n; i++) { *!* - // check if i is a prime number + // перевірка чи є i простим числом for (let j = 2; j < i; j++) { if (i % j == 0) continue nextPrime; } @@ -43,7 +43,7 @@ function showPrimes(n) { } ``` -The better variant, with a factored out function `isPrime`: +Кращим варінтом було б помістити код в окрему функцію `isPrime`: ```js @@ -65,21 +65,21 @@ function isPrime(n) { } ``` -Now we can understand the code easily. The function itself becomes the comment. Such code is called *self-descriptive*. +Тепер ми можемо зрозуміти код легко. Сама функція замінила нам коментар. Такий код називається *самоописним*. -### Recipe: create functions +### Рецепт: створюйте функції -And if we have a long "code sheet" like this: +І якщо ми маємо такий довгий фрагмент кода: ```js -// here we add whiskey +// тут ми додаємо віскі for(let i = 0; i < 10; i++) { let drop = getWhiskey(); smell(drop); add(drop, glass); } -// here we add juice +// тут ми додаємо сок for(let t = 0; t < 3; t++) { let tomato = getTomato(); examine(tomato); @@ -90,7 +90,7 @@ for(let t = 0; t < 3; t++) { // ... ``` -Then it might be a better variant to refactor it into functions like: +Тоді кращим варінтом буде замінити його на окремі функції: ```js addWhiskey(glass); @@ -111,39 +111,39 @@ function addJuice(container) { } ``` -Once again, functions themselves tell what's going on. There's nothing to comment. And also the code structure is better when split. It's clear what every function does, what it takes and what it returns. +Знову ж таки, ім'я функцій самі описують, що в них відбувається. Немає потреби коментувати такий код. Також кращою є структура кода, коли він розподілений. Стає зрозумілим, що функція робить, що вона приймає і що повертає. -In reality, we can't totally avoid "explanatory" comments. There are complex algorithms. And there are smart "tweaks" for purposes of optimization. But generally we should try to keep the code simple and self-descriptive. +Насправді, ми не можемо уникнути повністю "пояснювальних" коментарів. Є складні алгоритми. Також існують деякі "прийоми" для оптимізації. Проте, як правило, ми повинні намагатись залишати код простим та самоописним. -## Good comments +## Хороші коментарі -So, explanatory comments are usually bad. Which comments are good? +Тож, пояснювальні коментарі зазвичай погані. Які ж тоді хороші? -Describe the architecture -: Provide a high-level overview of components, how they interact, what's the control flow in various situations... In short -- the bird's eye view of the code. There's a special language [UML](http://wikipedia.org/wiki/Unified_Modeling_Language) to build high-level architecture diagrams explaining the code. Definitely worth studying. +Описуйте архітектуру +: Додавайте опис компонентів висого рівня, як вони взаємодіють, який потік управління мають у різних обставинах... Якщо коротко - огляд коду з висоту пташиного польоту. Є спеціальна мова [UML](https://uk.wikipedia.org/wiki/Unified_Modeling_Language) для побудови діаграм високорівневої архітектури кода. Її однозначно варто вчити. -Document function parameters and usage -: There's a special syntax [JSDoc](http://en.wikipedia.org/wiki/JSDoc) to document a function: usage, parameters, returned value. +Документуйте параметри функції та її використання +: Існує спеціальний синтаксис [JSDoc](https://uk.wikipedia.org/wiki/JSDoc) для документації функції: її використання, параметри, значення, що повертає. - For instance: + Наприклад: ```js /** - * Returns x raised to the n-th power. + * повертає x у n-й степені. * - * @param {number} x The number to raise. - * @param {number} n The power, must be a natural number. - * @return {number} x raised to the n-th power. + * @param {number} x число, що треба піднести до степеня. + * @param {number} n Степінь, повинно бути натуральним числом. + * @return {number} x пыднесене у n-у степінь. */ function pow(x, n) { ... } ``` - Such comments allow us to understand the purpose of the function and use it the right way without looking in its code. + Такі коментарі дозволяють нам зрозуміти мету функції та використовувати її правильно без потреби зазирати у її код. - By the way, many editors like [WebStorm](https://www.jetbrains.com/webstorm/) can understand them as well and use them to provide autocomplete and some automatic code-checking. + До речі, багато редакторів, наприклад [WebStorm](https://www.jetbrains.com/webstorm/) можуть їх розуміти та використовувати для автодоповнення і деякої автоматичної перевірки кода. - Also, there are tools like [JSDoc 3](https://github.com/jsdoc3/jsdoc) that can generate HTML-documentation from the comments. You can read more information about JSDoc at . + Також є інструменти, наприклад [JSDoc 3](https://github.com/jsdoc3/jsdoc), які можуть генерувати HTML-документацію з коментарів. Ви можете почитати більше про JSDoc тут: . Why is the task solved this way? : What's written is important. But what's *not* written may be even more important to understand what's going on. Why is the task solved exactly this way? The code gives no answer. From 4737f15f723fc67e3c2e4616e0781bd412c28d9c Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Fri, 28 Feb 2020 02:25:25 +0200 Subject: [PATCH 03/13] Corrected formatting - there were useless spaces --- 1-js/03-code-quality/03-comments/article.md | 43 +++++++++++---------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index 0c6d1b43a..c8aff2988 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -125,35 +125,36 @@ function addJuice(container) { Документуйте параметри функції та її використання : Існує спеціальний синтаксис [JSDoc](https://uk.wikipedia.org/wiki/JSDoc) для документації функції: її використання, параметри, значення, що повертає. - Наприклад: - ```js - /** - * повертає x у n-й степені. - * - * @param {number} x число, що треба піднести до степеня. - * @param {number} n Степінь, повинно бути натуральним числом. - * @return {number} x пыднесене у n-у степінь. - */ - function pow(x, n) { - ... - } - ``` +Наприклад: + +```js +/** + * повертає x у n-й степені. + * + * @param {number} x число, що треба піднести до степеня. + * @param {number} n Степінь, повинно бути натуральним числом. + * @return {number} x пыднесене у n-у степінь. + */ +function pow(x, n) { + ... +} +``` - Такі коментарі дозволяють нам зрозуміти мету функції та використовувати її правильно без потреби зазирати у її код. +Такі коментарі дозволяють нам зрозуміти мету функції та використовувати її правильно без потреби зазирати у її код. - До речі, багато редакторів, наприклад [WebStorm](https://www.jetbrains.com/webstorm/) можуть їх розуміти та використовувати для автодоповнення і деякої автоматичної перевірки кода. +До речі, багато редакторів, наприклад [WebStorm](https://www.jetbrains.com/webstorm/) можуть їх розуміти та використовувати для автодоповнення і деякої автоматичної перевірки кода. - Також є інструменти, наприклад [JSDoc 3](https://github.com/jsdoc3/jsdoc), які можуть генерувати HTML-документацію з коментарів. Ви можете почитати більше про JSDoc тут: . +Також є інструменти, наприклад [JSDoc 3](https://github.com/jsdoc3/jsdoc), які можуть генерувати HTML-документацію з коментарів. Ви можете почитати більше про JSDoc тут: . Why is the task solved this way? : What's written is important. But what's *not* written may be even more important to understand what's going on. Why is the task solved exactly this way? The code gives no answer. - If there are many ways to solve the task, why this one? Especially when it's not the most obvious one. +If there are many ways to solve the task, why this one? Especially when it's not the most obvious one. - Without such comments the following situation is possible: - 1. You (or your colleague) open the code written some time ago, and see that it's "suboptimal". - 2. You think: "How stupid I was then, and how much smarter I'm now", and rewrite using the "more obvious and correct" variant. - 3. ...The urge to rewrite was good. But in the process you see that the "more obvious" solution is actually lacking. You even dimly remember why, because you already tried it long ago. You revert to the correct variant, but the time was wasted. +Without such comments the following situation is possible: +1. You (or your colleague) open the code written some time ago, and see that it's "suboptimal". +2. You think: "How stupid I was then, and how much smarter I'm now", and rewrite using the "more obvious and correct" variant. +3. ...The urge to rewrite was good. But in the process you see that the "more obvious" solution is actually lacking. You even dimly remember why, because you already tried it long ago. You revert to the correct variant, but the time was wasted. Comments that explain the solution are very important. They help to continue development the right way. From 0e115eebdf8648bdad2358e1c0cde233815a7c95 Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Fri, 28 Feb 2020 20:42:32 +0200 Subject: [PATCH 04/13] Finish translation of the Comments; minor fixes --- 1-js/03-code-quality/03-comments/article.md | 52 ++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index c8aff2988..db1a0530a 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -2,7 +2,7 @@ Як нам відомо з розідлу , коментарі можна писати як на одному рядку: починаючи його з `//` так і на декількох рядках відокрлюючи їх за допомогою `/* ... */`. -Зазвичай ми використовуємо коментарі для опису опису того як і чому наш код працює. +Зазвичай ми використовуємо коментарі для опису того, як і чому наш код працює. На перший погляд, коментування може здаватись очевидним, проте початківці часто використовують їх неправильно. @@ -24,7 +24,7 @@ ### Рецепт: виносьте код у функції -Іноді має сенс замінити частину кода на функцію, наприклад: +Іноді має сенс замінити частину коду на функцію, наприклад: ```js function showPrimes(n) { @@ -69,7 +69,7 @@ function isPrime(n) { ### Рецепт: створюйте функції -І якщо ми маємо такий довгий фрагмент кода: +І якщо ми маємо такий довгий фрагмент коду: ```js // тут ми додаємо віскі @@ -111,7 +111,7 @@ function addJuice(container) { } ``` -Знову ж таки, ім'я функцій самі описують, що в них відбувається. Немає потреби коментувати такий код. Також кращою є структура кода, коли він розподілений. Стає зрозумілим, що функція робить, що вона приймає і що повертає. +Знову ж таки, ім'я функцій самі описують, що в них відбувається. Немає потреби коментувати такий код. Також кращою є структура коду, коли він розподілений. Стає зрозумілим, що функція робить, що вона приймає і що повертає. Насправді, ми не можемо уникнути повністю "пояснювальних" коментарів. Є складні алгоритми. Також існують деякі "прийоми" для оптимізації. Проте, як правило, ми повинні намагатись залишати код простим та самоописним. @@ -120,7 +120,7 @@ function addJuice(container) { Тож, пояснювальні коментарі зазвичай погані. Які ж тоді хороші? Описуйте архітектуру -: Додавайте опис компонентів висого рівня, як вони взаємодіють, який потік управління мають у різних обставинах... Якщо коротко - огляд коду з висоту пташиного польоту. Є спеціальна мова [UML](https://uk.wikipedia.org/wiki/Unified_Modeling_Language) для побудови діаграм високорівневої архітектури кода. Її однозначно варто вчити. +: Додавайте опис компонентів висого рівня, як вони взаємодіють, який потік управління мають у різних обставинах... Якщо коротко - огляд коду з висоту пташиного польоту. Є спеціальна мова [UML](https://uk.wikipedia.org/wiki/Unified_Modeling_Language) для побудови діаграм високорівневої архітектури коду. Її однозначно варто вчити. Документуйте параметри функції та її використання : Існує спеціальний синтаксис [JSDoc](https://uk.wikipedia.org/wiki/JSDoc) для документації функції: її використання, параметри, значення, що повертає. @@ -142,40 +142,40 @@ function pow(x, n) { Такі коментарі дозволяють нам зрозуміти мету функції та використовувати її правильно без потреби зазирати у її код. -До речі, багато редакторів, наприклад [WebStorm](https://www.jetbrains.com/webstorm/) можуть їх розуміти та використовувати для автодоповнення і деякої автоматичної перевірки кода. +До речі, багато редакторів, наприклад [WebStorm](https://www.jetbrains.com/webstorm/) можуть їх розуміти та використовувати для автодоповнення і деякої автоматичної перевірки коду. Також є інструменти, наприклад [JSDoc 3](https://github.com/jsdoc3/jsdoc), які можуть генерувати HTML-документацію з коментарів. Ви можете почитати більше про JSDoc тут: . -Why is the task solved this way? -: What's written is important. But what's *not* written may be even more important to understand what's going on. Why is the task solved exactly this way? The code gives no answer. +Чому завдання було вирішено у такий спосіб? +: Те, що написано є дуже важливим. Проте, те, що *не* написано може бути ще більш важливим, щоб зрозуміти, що саме відбувається. Чому завдання було вирішено саме у такий спосіб? Код не дає відповідь на це питання. -If there are many ways to solve the task, why this one? Especially when it's not the most obvious one. +Якщо існує декілька способів вирішення завдання, чому саме цей? Особливо, якщо цей спосіб не самий очевидний. -Without such comments the following situation is possible: -1. You (or your colleague) open the code written some time ago, and see that it's "suboptimal". -2. You think: "How stupid I was then, and how much smarter I'm now", and rewrite using the "more obvious and correct" variant. -3. ...The urge to rewrite was good. But in the process you see that the "more obvious" solution is actually lacking. You even dimly remember why, because you already tried it long ago. You revert to the correct variant, but the time was wasted. +Без таких коментарів можлива наступна ситуація: +1. Ви (або ваш колега) відкриває код, написаний колись раніше, і бачить, що він "неоптимальний". +2. Ви думаєте: "Який я був недосвідчений, і наскільки розумнішим я став зараз", і переписуєте код використовуючи "більш очевидний і правильний" варіант. +3. ...Бажання переписати код було хорошим. Але в процесі ви помічаєте, що "більш очевидне" рішення не є оптимальним. Ви навіти Ви навіть смутно пригадуєте чому воно так, тому що вже намаглись вирішити завдання таким способ колись давно. Ви вертаєте правильне рішення, проте час було витрачено марно. - Comments that explain the solution are very important. They help to continue development the right way. +Коментарі, які пояснюють рішення є дуже важливими. Вони допомагають продовжувати розробку правильним шляхом. -Any subtle features of the code? Where they are used? -: If the code has anything subtle and counter-intuitive, it's definitely worth commenting. +Чи є якісь тонкощі у коді? Де вони використовуються? +: Якщо код має якісь тонкощі та неочевидні речі, його точно варто коментувати. ## Підсумки -An important sign of a good developer is comments: their presence and even their absence. +Коментарі є важливою ознакою хорошого розробника: як їх наявність, так і їх відсутність. -Good comments allow us to maintain the code well, come back to it after a delay and use it more effectively. +Хороші коментарі полегшують нам підтримку коду, вертатись до нього через деякий час та використовувати його більш ефективно. -**Comment this:** +**Коментуйте наступне:** -- Overall architecture, high-level view. -- Function usage. -- Important solutions, especially when not immediately obvious. +- Загальну архітектуру, опис "високого рівня". +- Використання функцій. +- Важливі рішення, особливо, якщо вони не є очевидним. -**Avoid comments:** +**Уникайте коментарі:** -- That tell "how code works" and "what it does". -- Put them in only if it's impossible to make the code so simple and self-descriptive that it doesn't require them. +- Які описують, як код працює і що він робить. +- Пишіть їх тільки у тому випадку, коли не має змоги написати простий та самоописний код, якому пояснення не потрібні. -Comments are also used for auto-documenting tools like JSDoc3: they read them and generate HTML-docs (or docs in another format). +Коментарі також використовуються інструментами для автоматичної генерації документації, наприклад JSDoc3 - вони читають їх та генерують HTML-документи (або документи у іншому форматі). From 519fe021201ee64449afc1561a16da7ab25aabb2 Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Fri, 28 Feb 2020 23:11:01 +0200 Subject: [PATCH 05/13] minor update: removed space --- 1-js/03-code-quality/03-comments/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index db1a0530a..283db507c 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -52,7 +52,7 @@ function showPrimes(n) { for (let i = 2; i < n; i++) { *!*if (!isPrime(i)) continue;*/!* - alert(i); + alert(i); } } From 8ef3e3a5ec8c2728962c2ae19bfd339aee90d49c Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Sat, 29 Feb 2020 22:48:03 +0200 Subject: [PATCH 06/13] Update 1-js/03-code-quality/03-comments/article.md Co-Authored-By: Taras --- 1-js/03-code-quality/03-comments/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index 283db507c..f41755a3b 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -1,6 +1,6 @@ # Коментарі -Як нам відомо з розідлу , коментарі можна писати як на одному рядку: починаючи його з `//` так і на декількох рядках відокрлюючи їх за допомогою `/* ... */`. +Як нам відомо з розділу , коментарі можна писати як на одному рядку: починаючи його з `//` так і на декількох рядках, розділяючи їх за допомогою `/* ... */`. Зазвичай ми використовуємо коментарі для опису того, як і чому наш код працює. From 49c4109f358ebb030c73f34c55be78463d792842 Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Sat, 29 Feb 2020 22:48:44 +0200 Subject: [PATCH 07/13] Update 1-js/03-code-quality/03-comments/article.md Co-Authored-By: Taras --- 1-js/03-code-quality/03-comments/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index f41755a3b..3c83196e2 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -154,7 +154,7 @@ function pow(x, n) { Без таких коментарів можлива наступна ситуація: 1. Ви (або ваш колега) відкриває код, написаний колись раніше, і бачить, що він "неоптимальний". 2. Ви думаєте: "Який я був недосвідчений, і наскільки розумнішим я став зараз", і переписуєте код використовуючи "більш очевидний і правильний" варіант. -3. ...Бажання переписати код було хорошим. Але в процесі ви помічаєте, що "більш очевидне" рішення не є оптимальним. Ви навіти Ви навіть смутно пригадуєте чому воно так, тому що вже намаглись вирішити завдання таким способ колись давно. Ви вертаєте правильне рішення, проте час було витрачено марно. +3. ...Бажання переписати код було хорошим. Але в процесі ви помічаєте, що "більш очевидне" рішення не є оптимальним. Ви навіть смутно пригадуєте чому воно так, тому що колись давно вже намаглись спробувати такий варіант. Ви вертаєте правильне рішення, проте час було витрачено даремно. Коментарі, які пояснюють рішення є дуже важливими. Вони допомагають продовжувати розробку правильним шляхом. From 0f5d422a5dbf1ff4bac00cabd6bc49247518690c Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Sat, 29 Feb 2020 22:49:03 +0200 Subject: [PATCH 08/13] Update 1-js/03-code-quality/03-comments/article.md Co-Authored-By: Taras --- 1-js/03-code-quality/03-comments/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index 3c83196e2..9e93584e1 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -133,7 +133,7 @@ function addJuice(container) { * * @param {number} x число, що треба піднести до степеня. * @param {number} n Степінь, повинно бути натуральним числом. - * @return {number} x пыднесене у n-у степінь. + * @return {number} x піднесене у n-нну степінь. */ function pow(x, n) { ... From 379d44a83775d5f4ce5d6ae6247ac3f90acbe4ec Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Sat, 29 Feb 2020 22:50:07 +0200 Subject: [PATCH 09/13] Update 1-js/03-code-quality/03-comments/article.md Co-Authored-By: Taras --- 1-js/03-code-quality/03-comments/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index 9e93584e1..6a97b8cd7 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -79,7 +79,7 @@ for(let i = 0; i < 10; i++) { add(drop, glass); } -// тут ми додаємо сок +// тут ми додаємо сік for(let t = 0; t < 3; t++) { let tomato = getTomato(); examine(tomato); From 66301488974810be7ac92884fd99e2e5dcbe7b76 Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Sat, 29 Feb 2020 22:50:19 +0200 Subject: [PATCH 10/13] Update 1-js/03-code-quality/03-comments/article.md Co-Authored-By: Taras --- 1-js/03-code-quality/03-comments/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index 6a97b8cd7..eafb85982 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -65,7 +65,7 @@ function isPrime(n) { } ``` -Тепер ми можемо зрозуміти код легко. Сама функція замінила нам коментар. Такий код називається *самоописним*. +Тепер ми можемо легко зрозуміти код. Сама функція замінила нам коментар. Такий код називається *самоописним*. ### Рецепт: створюйте функції From bcdc3d1a8e19ddd0a5f4a2198e6a5d9a961bda6f Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Sat, 29 Feb 2020 22:50:39 +0200 Subject: [PATCH 11/13] Update 1-js/03-code-quality/03-comments/article.md Co-Authored-By: Taras --- 1-js/03-code-quality/03-comments/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index eafb85982..632a0a90a 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -6,7 +6,7 @@ На перший погляд, коментування може здаватись очевидним, проте початківці часто використовують їх неправильно. -## Погані кометарі +## Погані коментарі Початківці намагаються використовувати коментарі, щоб пояснити "що саме відбувається у коді". Наприклад: From 68ca20227773de36dd66a693a6ab756640e7b2e9 Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Sat, 29 Feb 2020 22:51:27 +0200 Subject: [PATCH 12/13] Update 1-js/03-code-quality/03-comments/article.md Co-Authored-By: Taras --- 1-js/03-code-quality/03-comments/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index 632a0a90a..c95d16d6d 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -132,7 +132,7 @@ function addJuice(container) { * повертає x у n-й степені. * * @param {number} x число, що треба піднести до степеня. - * @param {number} n Степінь, повинно бути натуральним числом. + * @param {number} n cтепінь, повинно бути натуральним числом. * @return {number} x піднесене у n-нну степінь. */ function pow(x, n) { From e731e5a4c001502b71f48d92e32b921795d176dd Mon Sep 17 00:00:00 2001 From: Alex Galkin Date: Sat, 29 Feb 2020 22:53:10 +0200 Subject: [PATCH 13/13] Small correction to variable i ref --- 1-js/03-code-quality/03-comments/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/03-code-quality/03-comments/article.md b/1-js/03-code-quality/03-comments/article.md index c95d16d6d..c6586c8ab 100644 --- a/1-js/03-code-quality/03-comments/article.md +++ b/1-js/03-code-quality/03-comments/article.md @@ -32,7 +32,7 @@ function showPrimes(n) { for (let i = 2; i < n; i++) { *!* - // перевірка чи є i простим числом + // перевірка чи є `i` простим числом for (let j = 2; j < i; j++) { if (i % j == 0) continue nextPrime; }