Capitalize in Javascript

5:51 PM

You can Capitalise a string by core Javascript. I've write a function for this :

String.prototype.capitalize = function() {
return this.replace(/(?:^|\s)\S/g, function(a) {
return a.toUpperCase();
});

};

You Might Also Like

0 comments