JS转换字符串单词首字母大写
代码如下:
const string = 'to young, too simple.';
const toUp = str => str.split(' ').map(item => item.charAt(0).toLocaleUpperCase() + item.slice(1)).join(' ');
toUp(string);
The MIT License (MIT)
Copyright (c) 2019, Roojay.
本文链接:https://roojay.com/pages/e11bdebd/