Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@leongaban
Last active February 21, 2019 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leongaban/25d144ef63a72447880345ff43ba50f8 to your computer and use it in GitHub Desktop.
Save leongaban/25d144ef63a72447880345ff43ba50f8 to your computer and use it in GitHub Desktop.
capitalizeFirstLetter
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
// ES6 & Typescript version:
export const capitalizeFirstLetter = (word: string) =>
word.charAt(0).toUpperCase() + word.slice(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment