Skip to content

Commit 58044fa

Browse files
committed
solve: 문자열 정렬하기 풀이
1 parent f950cd1 commit 58044fa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function solution(my_string) {
2+
let answer = [];
3+
for (let i of my_string) {
4+
if (i.charCodeAt() < 58) answer.push(Number(i));
5+
}
6+
return answer.sort();
7+
}
8+
9+
// 다른 풀이
10+
// function solution(my_string) {
11+
// return [...my_string]
12+
// .filter((v) => !isNaN(v))
13+
// .map((v) => parseInt(v))
14+
// .sort();
15+
// }

0 commit comments

Comments
 (0)