Skip to content

Instantly share code, notes, and snippets.

@AliceWonderland
Forked from anonymous/1.2 CamelCase.js
Created April 6, 2017 04:32
Show Gist options
  • Save AliceWonderland/1279ba8047363c9dc9073e85581fe86a to your computer and use it in GitHub Desktop.
Save AliceWonderland/1279ba8047363c9dc9073e85581fe86a to your computer and use it in GitHub Desktop.
1.2 CamelCase created by smillaraaq - https://repl.it/GtLj/2
function undertocamel(undername) {
var camelCaseOutput = "";
var foundUnder = false;
for(var i = 0; i<undername.length; i++) {
// undername[i];
if (undername[i] === "_") {
foundUnder = true;
} else {
if (foundUnder) {
camelCaseOutput += undername[i].toUpperCase();
foundUnder = false;
} else {
camelCaseOutput += undername[i];
}
}
}
return camelCaseOutput;
}
undertocamel("apply_now");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment