Discuss / JavaScript / 首字母大写可以用正则

首字母大写可以用正则

Topic source

i_shitou

#1 Created at ... [Delete] [Delete and Lock User]
return arr.map(function(str){
    str = str.toLowerCase();   
    return str.replace(/^\w/g, function(m){
        return m.toUpperCase();
    });
})

  • 1

Reply