Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update 문자열-다루기-기본&12918&.js #105

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

Merged
codeisneverodd merged 3 commits into codeisneverodd:main from soulhn:soulhn-patch-1
Sep 30, 2022

Conversation

Copy link
Contributor

@soulhn soulhn commented Sep 24, 2022

새롭게 추가된 문제 풀이

1/ 문자열 다루기 기본 eff3998

기존 풀이에 추가한 풀이

관련 이슈

Copy link
Owner

@codeisneverodd codeisneverodd left a comment

Choose a reason for hiding this comment

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

좋은 코드 잘 보았습니다!!
남긴 코멘트는 참고용으로만 보아주세요 😄

Comment on lines 56 to 57
.includes(NaN);
Copy link
Owner

@codeisneverodd codeisneverodd Sep 26, 2022

Choose a reason for hiding this comment

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

NaN 이 있느냐를 확인하시는 것이라면, some 메서드를 사용해보셔도 좋을 것 같아요!

Suggested change
.map((i) => parseInt(i, 10))
.includes(NaN);
.some(i => isNaN(parseInt(i, 10)));

MDN some

ssi02014 reacted with thumbs up emoji
Comment on lines 58 to 60
return false;
}
Copy link
Owner

@codeisneverodd codeisneverodd Sep 26, 2022
edited
Loading

Choose a reason for hiding this comment

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

early return 방식을 고려해보세요!
사용자(개발자)가 코드를 최소한으로 읽고 이해할 수 있도록, 함수 내에서 특정 조건에 return 이 되도록 되어있다면, 짧은 구문을 위로 올려 return 해보세요! depth 를 줄이고 가독성을 향상시킬 수 있습니다 😄

function solution(s) {
 if (s.length !== 4 && s.length !== 6) return false;
 
 return s.split('').some(i => isNaN(parseInt(i, 10)));
}

Early return pattern

ssi02014 and soulhn reacted with thumbs up emoji
Copy link
Contributor Author

Choose a reason for hiding this comment

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

좋은 리뷰 감사합니다. 도움 많이 받아갑니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

function solution(s) {
if (s.length !== 4 && s.length !== 6) return false;

return !s.split('').some(i => isNaN(parseInt(i, 10)));
}
정답은 이렇게 되면 제출이 됩니다!

Copy link
Owner

@codeisneverodd codeisneverodd Sep 26, 2022

Choose a reason for hiding this comment

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

@soulhn 혹시 수정하신 답으로 업로드 하고 싶으시다면, soulhn:soulhn-patch-1 브랜치로 새로운 내용을 push 하여 반영하여주세요!

Copy link
Contributor Author

soulhn commented Sep 27, 2022

이렇게 올리는게 맞을까요 fork pr도 처음이였는데
변수가 발생해서 조금 어렵네요

Copy link
Owner

@soulhn 네!! 잘 올려주셨습니다 😄 머지합니다!

@codeisneverodd codeisneverodd merged commit 7b21a65 into codeisneverodd:main Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@codeisneverodd codeisneverodd codeisneverodd approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /