function toCamelCase(str) { var pattern = /-([a-z])/g return str.replace(pattern,function(all,letter){ return letter.toUpperCase(); }) } console.log(toCamelCase(str))
function toCamelCase(str) { var pattern = /-([a-z])/g return str.replace(pattern,function(all,letter){ return letter.toUpperCase(); }) } console.log(toCamelCase(str))
转载于:https://www.cnblogs.com/hjbky/p/9510576.html