Skip to content

Instantly share code, notes, and snippets.

@ramsunvtech
Created September 25, 2018 20:26
Show Gist options
  • Save ramsunvtech/70eb0750597e21cd2a372d84a513251a to your computer and use it in GitHub Desktop.
Save ramsunvtech/70eb0750597e21cd2a372d84a513251a to your computer and use it in GitHub Desktop.
Capitalize the uneven Case String
function titleCase(str) {
return str.toLowerCase().split(' ').map((word) => `${word[0].toUpperCase() + word.slice(1)}` ).join(' ');
}
titleCase("hEllo wORld"); // "Hello World"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment