Skip to content

Instantly share code, notes, and snippets.

@trv469
Created October 21, 2019 17:40
Show Gist options
  • Save trv469/c91bf663e0250939f8ef43852c68a23b to your computer and use it in GitHub Desktop.
Save trv469/c91bf663e0250939f8ef43852c68a23b to your computer and use it in GitHub Desktop.
Capitalize en JS
function capitalizeLetter(string) {
let cadena = string.toLowerCase();
let spliteElememt = cadena.split(" ");
let capitalize = "";
for (const item of spliteElememt) {
capitalize += `${item.charAt(0).toUpperCase() + item.slice(1)} `;
}
return capitalize;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment