Share a small piece of code, input a string, and output a string with the first letter capitalized
Code
function capitalize(value) {
return value.charAt(0).toUpperCase() + value.slice(1)
}
// 代码测试
console.log(capitalize('hello'));
// Hello
Implementation code reference: