1.下划线转驼峰
function underlineToHump(s){
var a = s.split("_");
var result = a[0];
for(var i=1;i<a.length;i++){
result = result + a[i].slice(0,1).toUpperCase() + a[i].slice(1);
}
return result
}
调用后 underlineToHump('anshd_cdjop')结果是anshdCdjop
2.驼峰转下划线
function humpToUnderline(str){
return str.replace(/([A-Z])/g,"_$1").toLowerCase()
}