function changeStr(str = ‘hello-world-aaaa‘){ let s = ‘‘ let arr = str.split(‘-‘) for(let i = 0;i < arr.length;i++){ let item = arr[i] item = item.replace(item[0],item[0].toUpperCase()) s += item } return s }
原文:https://www.cnblogs.com/zhenjianyu/p/13341982.html