Skip to content

Instantly share code, notes, and snippets.

@arcdev1
Last active May 1, 2016 04:29
Show Gist options
  • Save arcdev1/6c104a72f287cf57dd786197ec6cb983 to your computer and use it in GitHub Desktop.
Save arcdev1/6c104a72f287cf57dd786197ec6cb983 to your computer and use it in GitHub Desktop.
var s = "some_string_to_change",
a = s.split("_"), // this gives us 4 strings and removes the underscore
result = a[0]; // this adds the first string to our result
for(i=1;i<a.length;i++) { // loop through each string
result+= a[i][0].toUpperCase(); // append the uppercase first letter of the string
result+= a[i].substring(1); // append the rest of the string
}
console.log(result); // log the result to the console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment