Title case a sentence function
A regular expression is really all you need:

/(^| +)([a-zA-Z])/g


Then use the String#replace method and pass in a function:

function toTitleCase(s) {
    return s.toLowerCase().replace(toTitleCase.WORD_PATTERN, function(match, $1, $2) {
        return $1 + $2.toUpperCase();
    });
}

toTitleCase.WORD_PATTERN = /(^| +)([a-zA-Z])/g;


If you really feel like it, jsperf.com can give you a good idea what the performance is.