Skip to content
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

Merged

Conversation

NargizaSalomova
Copy link
Contributor

@NargizaSalomova NargizaSalomova commented Dec 10, 2024

@keksobot keksobot changed the title Добавляет новые функции Нужно больше функций Dec 10, 2024
keksobot pushed a commit that referenced this pull request Dec 10, 2024
@keksobot
Copy link

♻️ Я собрал ваш пулреквест. Посмотреть можно здесь.

js/functions.js Outdated
Comment on lines 2 to 7
if(string.length <= length){
return true;
} else {
return false;
}
};
Copy link
Collaborator

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
Comment on lines 20 to 24
if(newString === invertedString){
return true;
} else {
return false;
}
Copy link
Collaborator

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){
Copy link
Collaborator

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
Comment on lines 37 to 39
if(replacedString[i] < 0){
numberString += Math.abs(replacedString[i]);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

никогда не выполнится, так как мы разбираем строку посимвольно

js/functions.js Outdated
Comment on lines 44 to 48
if(numberString === ''){
return NaN;
}
const number = Number(numberString);
return number;
Copy link
Collaborator

Choose a reason for hiding this comment

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

просто return parseInt(numberString, 10)

@Kartaviy-arteom Kartaviy-arteom merged commit cf0dda5 into htmlacademy-javascript:master Dec 11, 2024
1 check passed
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.

3 participants