Title Case a Sentence
function titleCase(str) {
let arr = str.split(' ')
let anw = []
for (let i of arr){
anw.push(i[0].toUpperCase() + i.slice(1).toLowerCase())
}
let w = anw.join(' ')
return w;
}
titleCase("I'm a little tea pot");
'Algorithms' 카테고리의 다른 글
freeCodeCamp - 13. Falsy Bouncer 한글 해석 [Basic Algorithm Scripting] (0) | 2023.01.30 |
---|---|
freeCodeCamp - 12. Slice and Splice [Basic Algorithm Scripting] (0) | 2023.01.30 |
freeCodeCamp - 10. Boo who [Basic Algorithm Scripting] (0) | 2023.01.26 |
freeCodeCamp - 9. Finders Keepers [Basic Algorithm Scripting] (0) | 2023.01.26 |
freeCodeCamp - 8. Truncate a String [Basic Algorithm Scripting] (0) | 2023.01.26 |