-
Notifications
You must be signed in to change notification settings - Fork 32
Козельских_ДЗ первой недели #37
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
base: dev
Are you sure you want to change the base?
Conversation
function isTriangle(a, b, c) { | ||
isTriangle(7, 2, 2) | ||
function isTriangle(a, b, c) { | ||
if (a + b > c && a + c > b && b + c > a) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 целочисленных значения
добавить валидацию входных аргументов
calculateDoubleArray(array) | ||
|
||
function calculateDoubleArray(array) { | ||
for (let i = 0; i < array.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавить проверку входного массива на корректность
i++ | ||
} | ||
} | ||
return array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calculateDoubleArray([1, 2, 3, 4, 5]) - вернёт тот же результат что и [1, 2, 3, 4, 5, 0, 0, 0, 0, 0].
Добавить логику проверки для свободных ячеек.
@@ -10,6 +10,19 @@ | |||
*/ | |||
|
|||
function factorial(n) { | |||
if (n > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нет проверки, что входной аргумент число, и что оно целое
function countUniqueName(nameArray) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function kaprekarConstant(number){ | ||
|
||
function kaprekarConstant(number) { | ||
let countDigits = number.toString().length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kaprekarConstant(2223) - зависает. Добавить обработку входных данных
throw new Error('Число не должно состоять из одинаковых цифр.') | ||
} | ||
} else { | ||
throw new Error('Число не из 4-х цифр.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
думаю можно уточнить условие проверки)
https://www.dcode.fr/kaprekar-algorithm - я тестил тут
No description provided.