Skip to content

Instantly share code, notes, and snippets.

@Fray117
Created May 25, 2022 10:39
Show Gist options
  • Save Fray117/ce19b3d779964ac2e0763600a40b75f1 to your computer and use it in GitHub Desktop.
Save Fray117/ce19b3d779964ac2e0763600a40b75f1 to your computer and use it in GitHub Desktop.
function CamelCase(str) {
return str.split(/\W/).map(val => {
let raw = val.toLowerCase()
return raw.charAt(0).toUpperCase() + raw.slice(1)
}).join('');
}
// keep this function call here
console.log(CamelCase("BOB loves-coding"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment