Skip to content

1 / 자연수-뒤집어-배열로-만들기 23b8ededbcc7bc50d3fbc04f457029adc2def830 #114

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

inhwa-jang
Copy link

@inhwa-jang inhwa-jang commented Oct 19, 2022

자연수-뒤집어-배열로-만들기&12932&.js 풀이추가

새롭게 추가된 문제 풀이

기존 풀이에 추가한 풀이

function solution(n) {
let str = String(n);
let newArr = Array.from(str);
newArr.reverse();
return newArr.map(Number);
}

관련 이슈

자연수-뒤집어-배열로-만들기&12932&.js 풀이추가
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.

좋은 코드 잘 보았습니다! 문제되는 부분이 없어 Approve 합니다 😄
앞으로도 많은 기여 부탁드려요!!

Comment on lines +70 to +73
let str = String(n);
let newArr = Array.from(str);
newArr.reverse();
return newArr.map(Number);
Copy link
Owner

Choose a reason for hiding this comment

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

아래와 같은 메서드 체이닝을 도입해 가독성을 높혀보세요!

Suggested change
let str = String(n);
let newArr = Array.from(str);
newArr.reverse();
return newArr.map(Number);
return Array.from(String(n)).reverse().map(Number);

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants