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

Commit a1d5e4c

Browse files
chaerin-devprove-ability
authored andcommitted
Add 가운데-글자-가져오기.js
1 parent 147111e commit a1d5e4c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎level-1/가운데-글자-가져오기.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ function solution(s) {
2929
// 홀수인 경우 - 중간지점
3030
else answer = s[point];
3131
return answer;
32-
}
32+
}
33+
34+
// 정답 4 - chaerin-dev
35+
function solution(s) {
36+
return s.length % 2
37+
? s[parseInt(s.length / 2)]
38+
: s[s.length / 2 - 1] + s[s.length / 2];
39+
}
40+

0 commit comments

Comments
(0)

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