@xavi5 wrote:
Solution: The online compiler thing does not like it when I place global variables for some reason?
function titleCase(str) { var string=""; //<----buffer variable str=str.toLowerCase().split(' '); for(a=0;a<=str.length-1;a++) { string+=str[a][0].toUpperCase(); for(var b=1;b<str[a].length;b++) { string+=str[a][b]; } if(a==str.length-1) continue;// else string+=' '; // Do not place a space on a final word } return string; } titleCase("tHe wIZARD oF oZ"); //"The Wizard Of Oz"