-
Notifications
You must be signed in to change notification settings - Fork 0
First 5 tasks #1
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: master
Are you sure you want to change the base?
Conversation
| } | ||
| else | ||
| return false | ||
| } |
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.
Всё эту функцию лучше свернуть в одну строчку :)
return value.match(/^[+]?\d+(\.\d+)?$/) && parseInt(value) < 15 && parseInt(value) > 0;
И для приведения к числу лучше parseInt использовать, в некоторых кейсах он отрабатывает лучше
| return false | ||
| } | ||
| else | ||
| return false |
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.
Тут тоже странно
if (isString(sampleActivity) && isValid(sampleActivity)) {
return ...
} else {
return false;
}
а за такое любой линтер начнёт матом ругаться
else
return ...
я знаю что в питоне это ок, а у нас так не принято
| let firstLetters = []; | ||
| for (member of members){ | ||
| if(isString(member)){ | ||
| firstLetters.push(member.split(' ').join('').toUpperCase()[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.
К символам строки тоже можно через квадратные скобки обращаться
member[0].toUpperCase() хватило бы здесь
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.
а чтобы избавиться от пробелов в начале строки можно метод trim() использовать
| // remove line with error and write your code here | ||
| function convertHoursToSeconds(hours) { | ||
| return Math.floor(hours * 60 * 60); | ||
| } |
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.
Думаю, лишняя функция. Хватило бы одной константы
| return { | ||
| 'turns': turns, | ||
| 'seconds': seconds | ||
| } |
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.
здесь можно было просто написать:
return { turns, seconds };
| calculateDepth = function calculateDepth(arr){ | ||
| return 1 + (arr instanceof Array ? arr.reduce(function(max, item) { | ||
| return Math.max(max, calculateDepth(item)); | ||
| }, 0) : -1); |
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.
Охох, тернарки иногда не стоит использовать :)
здесь лучше распить через if {} else {}
| // remove line with error and write your code here | ||
| let str = ''; | ||
| for (ind in this.arr){ | ||
| if (ind == 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.
Не лучшая идея проверять это условие каждую итерацию.
Я бы сначало через map() метод добавил скобки к элементам, а после соединил через .join('~~')
| let index = array.indexOf(elem); | ||
| array.splice(index, 1); | ||
| let newArray = controlSequences[elem](array, index); | ||
| return transform(newArray) |
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.
О_О слишком сложно, рекурсия здесь точно не нужна
| } | ||
| } | ||
| catch (e) { | ||
| throw (e) |
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.
throw не должен вызываться в блоке catch
наоборот его вызывают в блоке try, чтобы попасть в catch
No description provided.