转化为驼峰命名

# 转化为驼峰命名

var s1 = "get-element-by-id"

// 转化为 getElementById

var f = function(s) {
    return s.replace(/-\w/g, function(x) {
        return x.slice(1).toUpperCase();
    })
}
1
2
3
4
5
6
7
8
9
上次更新: 2022/7/2 上午7:51:43