freeCodeCamp Challenge Guide: Title Case a Sentence
Hi all, I’ve had such hard time solving this exercise. I finally did it after looking at this page, but it feels I have copied the answer even with minor tweaks. I’ve copied 2 of my codes (I tried a...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
My approach on this challenge: function titleCase(str) { var arr = []; var upperCase; var lowerCase = str.toLowerCase(); var words = lowerCase.split(’ ');//array of lowerCase words for(var i = 0;i...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
Hi there, here is my solution to the problem. Capitalizing the first character of each element of string array ‘str’ then ‘lowercasing’ the other characters in the remainder of each element. Join them...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
Your result is ' Short And Stout' There is a space on the begin, so your submit failed Read full topic
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
Someone could explain me what (L) means in the Advanced solution? Thank you Read full topic
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
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 =...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
False alarm. I didn’t declare the variable fullStr inside the function. Read full topic
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
Here’s my solution! function titleCase(str) { var words = str.toLowerCase().split(’ ‘); var upper = []; for (var i = 0; i < words.length; i++) { upper.push(words[i].charAt(0).toUpperCase() +...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
Can anyone help me, I have no idea why this doesn’t pass all cases. function titleCase(str) { var arr = str.split(’ ‘); var newStr = ‘’; for (var i = 0; i < arr.length; i++){ var word =...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
Here is what I was able to come up with for my solution using splice. function titleCase(str) { var lowerCase = str.toLowerCase(); var wordArray = lowerCase.split(" "); var newWord = []; var newLetter...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
While my code for this challenge was a little dirty, I was able to finish it. However, although the output is correct, it does not move on to the next challenge. Anyone else have this problem? Read...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
Same here! I wrote the following code which seems to give all the desired outputs, yet I only get a checkmark for the first criteria but a red X for the other three. function titleCase(str) { var arr...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
Is there someone who would be able to verify why this is happening? Moderators perhaps? [spoiler]function titleCase(array) { var finalArray = ''; var lowerC = array.toLowerCase().split(' '); for(var i...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
var i = 0; function titleCase(str) { var little = str.toLowerCase(); var words = str.split(" "); while (i<words.length){ words.replace( words[i].charAt(0).toUpperCase(),words[i].charAt(0)); i++; }...
View ArticlefreeCodeCamp Challenge Guide: Title Case a Sentence
camperbot: Basic Code Solution: The “Basic” Code Solution doesn’t look basic at all. Am I the only one who found it super confusing? The Intermediate Code Solution was a bit easier to understand… Read...
View ArticlefreeCodeCamp 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