Skip to content

Владислав Садыров - #7

Open
SVladislav wants to merge 2 commits into
trpomoais2017:masterfrom
SVladislav:master
Open

Владислав Садыров#7
SVladislav wants to merge 2 commits into
trpomoais2017:masterfrom
SVladislav:master

Conversation

@SVladislav

Copy link
Copy Markdown

Снежинка Коха

Снежинка Коха
Comment thread SK.js Outdated
context.fillRect(0, 0, 0, 0);
addEventListener("keydown", function(event) {
if (event.code == "Enter"){
i=3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тебе не нужны глобальные переменные i, k, раз ты их в начале обработчика перетираешь. На самом деле глобальных переменных вообще следует избегать.

Comment thread SK.js Outdated
context.clearRect(200, -2,-1000, 900);
context.fillRect(0, 0, 0, 0);
context.fillStyle = "red";
while((i--)>0){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выделить этот цикл в отдельную функцию - правильная идея. Так ты отделишь хитрую логику обработки ошибок в пользовательском вводе от алгоритма. Читабельность повысится, возможность повторного использования кода (алгоритма) тоже. Да, здесь негде переиспользовать, но хорошие привычки надо вырабатывать

Comment thread SK.js Outdated
function inRad(num) {
return num * Math.PI / 180;
}
function Coha(n, k){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Названия функций должны быть глаголами

Исправленный
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants