Tell us what’s happening:
Hi everyone,
I did try to solve the Title Case problem and my solution seems to work however the website doesn’t consider me as successful and doesn’t allow me to pass on the next challenge.
Could you review my code and enlight me with guidance,
Thank you,
Xavier
Your code so far
function titleCase(str) {
var arr = str.toLowerCase().split(" ");
var updatedWord;
var newPhrase = "";
function upperCase(letter){
return letter.toUpperCase();
}
for (i = 0; i < arr.length; i++){
updatedWord = arr[i].replace(arr[i][0],upperCase(arr[i][0]));
newPhrase += updatedWord+" ";
}
return newPhrase;
}
titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
.
Link to the challenge: