Skip to content

Commit 996a4ee

Browse files
author
gyeong-hyeon-kim
committed
Solved 1 problem
1 parent 4826efa commit 996a4ee

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//https://github.com/codeisneverodd/programmers-coding-test
2+
//완벽한 정답이 아닙니다.
3+
function solution(s) {
4+
var answer = ''
5+
answer = s.split(' ').map(word=> word.charAt(0).toUpperCase() + word.substring(1).toLowerCase()).join(' ')
6+
//word[0]은 빈 문자열을 만나면 undefined를, word.charAt(0)은 빈 문자열을 만나면 빈 문자열을 반환한다.
7+
return answer;
8+
}

0 commit comments

Comments
 (0)