freeCodeCamp Challenge Guide: Title Case a Sentence
Here is what I came up with L function titleCase(str) { var arr1 = str.toLowerCase().split(" "); var arr11 = []; for (a = 0; a < arr1.length; a++) { arr11.push(arr1[a][0].toUpperCase() +...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
My solution seems to be valid, why isn’t it working? var string=[]; function titleCase(str) { str=str.toLowerCase().split(' '); for(var a=0;a<=str.length-1;a++) {...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
For me this worked out pretty easy! function titleCase(str) { var splitted = str.toLowerCase().split(" "); for (i=0; i<splitted.length; i++) { splitted[i]=splitted[i].charAt(0).toUpperCase() +...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
MY SOLUTION titleCase(Str) { var oldArr = str.toLowerCase().split(' '); var newArr = []; for (var i in oldArr) { var newWord = oldArr[i][0].toUpperCase() + oldArr[i].slice(1); newArr.push(newWord); }...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
Solution: The online compiler thing does not like it when I place global variables for some reason? function titleCase(str) { var string=""; //<----buffer variable str=str.toLowerCase().split(' ');...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
function titleCase(str) { return str.toLowerCase() .split(' ') .map(word => word[0].toUpperCase() + word.slice(1, word.length)) .join(' '); } Read full topic
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
How about this version? function titleCase(str) { return str.toLowerCase().split(' ').map(a => a.charAt(0).toUpperCase() + a.substr(1)).join(' '); } Read full topic
View Article