Last active
May 1, 2016 04:29
-
-
Save arcdev1/6c104a72f287cf57dd786197ec6cb983 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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