-
Notifications
You must be signed in to change notification settings - Fork 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
Нужно больше функций #2
Нужно больше функций #2
Conversation
♻️ Я собрал ваш пулреквест. Посмотреть можно здесь. |
js/functions.js
Outdated
if(string.length <= length){ | ||
return true; | ||
} 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/else тут избыточен и блок будет не нужен
просто checkLength = (string, length) => string.length <= length
js/functions.js
Outdated
if(newString === invertedString){ | ||
return true; | ||
} 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.
аналогично это не нужно
js/functions.js
Outdated
let numberString = ''; | ||
|
||
for(let i = 0; i <= replacedString.length - 1; i++){ | ||
if(isNaN(replacedString[i]) === 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(!isNaN(replacedString[i])
js/functions.js
Outdated
if(replacedString[i] < 0){ | ||
numberString += Math.abs(replacedString[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.
никогда не выполнится, так как мы разбираем строку посимвольно
js/functions.js
Outdated
if(numberString === ''){ | ||
return NaN; | ||
} | ||
const number = Number(numberString); | ||
return number; |
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 parseInt(numberString, 10)
cf0dda5
into
htmlacademy-javascript:master
🎓 Нужно больше функций
💥 https://htmlacademy-javascript.github.io/2506775-kekstagram-2/2/