erknrio of Programming Guanches
5/7/2015 - 2:06 PM

Capitalize From http://codereview.stackexchange.com/questions/77614/capitalize-the-first-character-of-all-words-even-when-following-a

String.prototype.capitalize = function(){
    return this.toLowerCase().replace( /\b\w/g, function (m) {
        return m.toUpperCase();
    });
};

var myString = 'foo';
window.alert(myString.capitalize());