Tell us what’s happening:
i am through with the problem but i want to insert white space in between the output not including the last part something like this I_Am_Happy where “_” is the white space and not I_am_happy
Your code so far
function titleCase(str) {
let arr = str.split(" ")
let upper = ""
let complete =""
for (var i = 0; i < arr.length; i++) {
upper = arr[i][0].toUpperCase() + arr[i].slice(1);
complete += " " + {upper};
}
console.log(complete);
return complete;
}
titleCase("I'm a little tea pot");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence/