字符串首字母大写

结果:

/**
 * 
 * @param {*} str  字符串
 * @returns 
 */
const fistLetterUpper = (str) => {
    return str.charAt(0).toUpperCase() + str.slice(1);
};
console.log(fistLetterUpper('abc'))

 

posted @ 2022-05-26 22:26  前端搬运工bug  阅读(24)  评论(0)    收藏  举报