1234function capitalize(string) { return string.charAt(0).toUpperCase() + string.slice(1);}capitalize("abc"); // Abc 1234String.prototype.capitalized = function () { return this.charAt(0).toUpperCase() + this.slice(1);};"abc".capitalized(); // Abc 参考 首字母大写: https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript?page=2&tab=scoredesc#tab-top