I try to capitalize the first letters of a string, i.e. "hello world" argument should return "Hello World". I keep getting a blank string returned, I think there is some basic syntax error with the if statement that I can't figure out. Code:
function LetterCapitalize(str) {
var output = " "
for(var i=0; i < str.length; i++);
if(str.charAt(i - 1) == " ") {
str.charAt(i).toUpperCase;
output += str.charAt(i);
} else {
output += str.charAt(i);
}
return output
}
LetterCapitalize("hello world")