-
-
Save IrhaAli/b496c2a518e5251bd83e7e81c1ba4091 to your computer and use it in GitHub Desktop.
Turn a string into camel case
This file contains 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
const camelCase = function(input) { | |
//split the words | |
let output = input.split(' '); | |
//capitalize the words | |
for (let i = 1; i < output.length; i++){ | |
output[i] = output[i].charAt(0).toUpperCase() + output[i].substring(1); | |
} | |
//join the words | |
return output.join(''); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment