Hello, please i need help.
I dont know what is wrong with my function, it outputs the same thing and i cant pass the challenge.
Thank you in Advance
Here is my code:
function titleCase(str) {
let arr = str.split(" ");
let newStr = '';
for(let i = 0; i<arr.length; i++){
let res = arr[i].charAt(0).toUpperCase() + arr[i].slice(1).toLowerCase();
newStr = newStr.concat(res, ' ')
}
return newStr;
}