This feature extends the JavaScript string class by adding a method that allows us to put the first letter in uppercase.
String.prototype.capitalize = function() { return this.toLowerCase().replace(/(^|\s)([a-z])/g, function(m, p1, p2) { return p1 + p2.toUpperCase(); }); };