function titleCase(str) {
var newStr = “”;
var strToArray = str.split(" ");
for(var i = 0; i < strToArray.length; i++){
newStr += strToArray[i].charAt(0).toUpperCase() + strToArray[i].substr(1).toLowerCase() + " ";
}
return newStr;
}
titleCase(“I’m a little tea pot”);
titleCase(“I’m a little tea pot”);
titleCase(“sHoRt AnD sToUt”);
titleCase(“HERE IS MY HANDLE HERE IS MY SPOUT”);
This is my code^. i called the function and it returned what it was supposed to. however, only one function call seems to be working.