📜  js 首字母大写 - Javascript 代码示例

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

代码示例6
// this will only capitalize the first word
var name = prompt("What is your name");
firstLetterUpper = name.slice(0,1).toUpperCase();

alert("Hello " + firstLetterUpper + name.slice(1, name.length).toLowerCase());