驼峰题写一个正则的解法: function solution(str) { return str.replace(/-\w/g, (word) => { // 捕获-和后面的字母 return word[1].toUpperCase() // 返回后面的字母的大写形式 }) }