📅  最后修改于: 2022-03-11 15:01:26.750000             🧑  作者: Mango
function capitalize(paragraph) {
const paragraphCleaned = paragraph.replace(/\s{2,}/, " ")
const paragraphSplitted = paragraphCleaned.split(" ")
const capitalized = paragraphSplitted.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
return capitalized.join(" ")
}