Here is my code:
export const capitalizeEachWord = (s) => {
let arrS = s.toLowerCase().split(' ');
for (let i = 0; i < arrS.length; i++) {
arrS[i] = arrS[i][0].toUpperCase() + arrS[i].substr(1, arrS.length);
}
return arrS.join(' ');
}
After submit i complete only 2/4 tasks and get these 2 errors:
1.The length of the string should remain the same
2.All other characters of the string except the first letter of each word, should remain the same
In the terminal i see the correct result, i can't quite understand what i've done wrong..