Skip to content

Instantly share code, notes, and snippets.

@kuznetsovandrey76
Created March 10, 2021 08:31
Show Gist options
  • Save kuznetsovandrey76/b4bbc624d62c35ba17e8e9b5a9184568 to your computer and use it in GitHub Desktop.
Save kuznetsovandrey76/b4bbc624d62c35ba17e8e9b5a9184568 to your computer and use it in GitHub Desktop.
CAPITAL to CamelCase
let str = "TIRE AND WHEEL AGREEMENT SECTION";
let res = '';
str
.toLowerCase()
.split(' ')
.forEach((el, i) => {
if (i) {
el = el.charAt(0).toUpperCase() + el.slice(1);
}
res += el;
})
console.log(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment