📌  相关文章
📜  字符串到标题大小写 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:44.053000             🧑  作者: Mango

代码示例2
function titleCase(sentence) {
  let sentence = string.toLowerCase().split(" ");
  for (let i = 0; i < sentence.length; i++) {
    sentence[i] = sentence[i][0].toUpperCase() + sentence[i].slice(1);
  }
  
  return sentence.join(" ");
}