Skip to content

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

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions level-1/자연수-뒤집어-배열로-만들기&12932&.js
Original file line number Diff line number Diff line change
@@ -64,3 +64,11 @@ function solution(n) {
}
return answer;
}

// 정답 7 - inhwa-jang
function solution(n) {
let str = String(n);
let newArr = Array.from(str);
newArr.reverse();
return newArr.map(Number);
Comment on lines +70 to +73
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);

}