Files
30-seconds-of-code/snippets/capitalize-first-letter.md
2017-12-12 07:11:37 -05:00

219 B

Capitalize first letter

Use slice(0,1) and toUpperCase() to capitalize first letter, slice(1) to get the rest of the string.

const capitalize = str => str.slice(0, 1).toUpperCase() + str.slice(1);