function capitalizeFirstLetter(str) { str = str.toLowerCase(); return str.charAt(0).toUpperCase() + str.slice(1); } console.log(capitalizeFirstLetter("I'm a little tea pot"));
最后结果是:I'm A Little Tea Pot