SOURCE

function toString(foo) {
    var arr = foo.split('-');
    for (var i = 1; i < arr.length - 1; i++) {
        arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].substr(1, arr[i].length - 1);
    }
    return arr.join('')
}
console.log(toString('get-element-by-id'));
console 命令行工具 X clear

                    
>
console