Quantcast
Channel: freeCodeCamp Challenge Guide: Title Case a Sentence
Viewing all articles
Browse latest Browse all 50

freeCodeCamp Challenge Guide: Title Case a Sentence

$
0
0

Can anyone tell me why this code does not complete the challenge? I can’t seem to find the problem. It looks like it returns the right answer.

var fullStr = “”;
function titleCase(str) {
str = str.toLowerCase().split(" “);
for (var i = 0; i < str.length; i++){
var capitalize = str[i].substring(0,1).toUpperCase();
var loseFirst = str[i].substr(1);
fullStr = fullStr + capitalize + loseFirst +” ";
}
return fullStr.substring(0, fullStr.length -1);
}

titleCase(“sHoRt AnD sToUt”);

Read full topic


Viewing all articles
Browse latest Browse all 50

Trending Articles


FORTUITOUS EVENT


Dibujos de Molang para colorear e imprimir


Jimmy Neutron para colorear


Girasoles para colorear


INUMAN QUOTES


RE: Mutton Pies (frankie241)


Hagibis (1946) by Francisco V. Coching


Re: lwIP PIC32 port - new title : CycloneTCP a new open source stack for...


Vimeo 11.5.0 by Vimeo.com, Inc.


Vimeo 11.6.0 by Vimeo.com, Inc.