javascript remove underscore and capitalize

Solutions on MaxInterview for javascript remove underscore and capitalize by the best coders in the world

showing results for - "javascript remove underscore and capitalize"
Giulio
16 May 2016
1function humanize(str) {
2  var i, frags = str.split('_');
3  for (i=0; i<frags.length; i++) {
4    frags[i] = frags[i].charAt(0).toUpperCase() + frags[i].slice(1);
5  }
6  return frags.join(' ');
7}
8
9
10humanize('humpdey_dumpdey');
11// > Humpdey Dumpdey
12