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

8 lines
219 B
Markdown

### Capitalize first letter
Use `slice(0,1)` and `toUpperCase()` to capitalize first letter, `slice(1)` to get the rest of the string.
```js
const capitalize = str => str.slice(0, 1).toUpperCase() + str.slice(1);
```