var str = 'hello-world-abc'; var strSplit = str.split('-'); for(var i=1;i<strSplit.length;i++){ strSplit[i] = strSplit[i][0].toUpperCase()+strSplit[i].slice(1); } var res = strSplit.join(''); console.log(res);