I created this code and most of it is working with the exception of the toUpperCase which should make every first letter of a word uppercase. There is no error so I am not sure why the method is not currently working. Why may this be the case.
let str ="insert string here"
String.prototype.toCase = function () {
let arrayWord = str.split("");
for (let i = 0; i<str.length; i++){
if (arrayWord[i]===" "){
arrayWord[i+1].toUpperCase();
}
else{
}
}
let result = arrayWord.join("");
return (result)
};