/*
*已知有字符foo="get-element-by-id",写一个function将其转换成驼峰表示法"getElementById"
*/
var o = {
trans:function (msg){
var i;
tempArr = msg.split("-");//将字符串进行分割
len = tempArr.length;
for(i = 1; i < len; i++){
tempArr[i] = tempArr[i].charAt(0).toUpperCase()+tempArr[i].substr(1,tempArr[i].length-1);
}
msg = tempArr.join("");
return msg;
}
};
o.trans("get-element-by-id");